History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XDT-697
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: xdoclet-devel (Use for new issues)
Reporter: Jan Berkel
Votes: 7
Watchers: 7
Operations

If you were logged in you would be able to see more operations.
XDoclet

Hibernate module ignores interface "subclassing"

Created: 02/Nov/03 06:57 PM   Updated: 26/Jul/05 04:54 PM
Component/s: Hibernate Module
Affects Version/s: 1.2 Beta 3
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Text File patch-extends.txt (17 kb)
2. Text File patch.txt (0.7 kb)
3. Text File xdoclet-interface.patch (11 kb)



 Description  « Hide
hibernatedoclet doesn't support interfaces and @subclass.

/** @hibernate.class table="FOO" */
public interface Foo
{
 // method declaration + doclets
}

/** @hibernate.subclass */
public class FooImpl implements Foo
{
 // implementation
}

this should produce:

<hibernate-mapping>
 <class name="Foo" table="FOO">

 ...properties...
 <subclass name="FooImpl">
 ...properties...
 </subclass>
</class>

but classes implementing Foo are silently ignored by the hibernate module, so the <subclass> -element inside the generated mapping file is missing.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jan Berkel - 02/Nov/03 07:00 PM
patch fixing the bug

Kim Pepper - 27/Oct/04 02:44 AM
Is this patch going to be applied?

François Beausoleil - 02/Dec/04 09:53 PM
Having the same problem, but all my classes are concrete, and I have a class sitting between my root and my subclass, something like this:

/** @hibernate.class ... */
class Activity {
}

class BodiedActivity extends Activity {
}

/** @hibernate.subclass ... */
class EmailActivity extends BodiedActivity {
}

I checked the patch - it seems pretty trivial to me. Only five changed lines. Can this be applied ?

Thanks !
François

Christian Kesselheim - 17/Jan/05 03:48 AM
Are there going to be some problematic side-effects with the patch in question or why isn't it applied? Seems to work fine on my machine...

Jan Berkel - 17/Jan/05 06:17 AM
new version of above patch which supports more complex object hierarchies

Jan Berkel - 17/Jan/05 06:29 AM
seems that hibernate support for xdoclet 1.2 is orphaned. see the following thread in the hibernate forum:

http://forum.hibernate.org/viewtopic.php?t=936977

Jan Berkel - 17/Jan/05 06:47 AM
forgot to mention that the second patch also includes a fix to
http://opensource.atlassian.com/projects/xdoclet/browse/XDT-698

Heiko W. Rupp - 17/Jan/05 07:02 AM
There might be less activity at the moment, but Xdoclet 1 is not orphanded.

Stein Martin Hustad - 26/Jul/05 04:54 PM
I don't know if this patch will be applied, but someone may find it useful.

I have made an updated patch that adds an extends attribute to the @hibernate.subclass tag. This makes it possible to explicitly tell hibernate what it should consider the supertype to be. Useful when you want a class both extending one class and implementing another interface to behave as a subtype of the interface rather than the parent class. F.ex.

/**

 * @hibernate.class table="files"

 * @hibernate.discriminator column="discriminator"

 */

public interface File {...}

/**
 * @hibernate.subclass extends="File"

 */

public class FileImpl {...}

/**
 * @hibernate.subclass extends="File"
 */
public interface Folder extends File {...}

/**
 * @hibernate.subclass extends="Folder"
 */
public class FolderImpl extends FileImpl implements FileImpl {...}

Using this patch, a query of the type "from Folder f where <some criteria>" will return all FolderImpl's that match the criteria. Without this patch, nothing will return, as the FolderImpl are considered to be a subtype of FileImpl, not Folder.