[hibernate-issues] [Hibernate-JIRA] Created: (ANN-848) Bidirectional Polymorphism
Yong Joo Jeong (JIRA)
noreply at atlassian.com
Thu Jun 25 21:44:33 EDT 2009
Bidirectional Polymorphism
--------------------------
Key: ANN-848
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-848
Project: Hibernate Annotations
Issue Type: New Feature
Components: binder
Affects Versions: 3.4.0.GA
Environment: 3.4.0.GA, Any database
Reporter: Yong Joo Jeong
I'm trying to implement bidirectional polymorphic class.
Code:
public class Order{
...
@Any( metaColumn = @Column( name = "item_type" ), fetch=FetchType.EAGER )
@AnyMetaDef(
idType = "long",
metaType = "string",
metaValues = {
@MetaValue( value = "ItemA", targetEntity = ItemA.class ),
@MetaValue( value = "ItemB", targetEntity = ItemB.class )
} )
@JoinColumn( name = "item_id" )
Object item;
...
}
And trying to do somthing like the following
Code:
public class ItemA {
@OneToAny // like @OneToMany; in Order table there are "item_id" and "item_type" fields to distinguish ItemA and ItemB
List<Order> orders;
...
}
RoR support this kind of relationship, but I can't find it from Hibernate.
Inheritance with "Table per class" is not an option since it does not support the IDENTITY generator strategy.
Any solution for this?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list