-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Bidirectional Polymorphic?
PostPosted: Thu Jun 25, 2009 9:34 pm 
Newbie

Joined: Thu Jun 25, 2009 9:16 pm
Posts: 1
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?


Top
 Profile  
 
 Post subject: Re: Bidirectional Polymorphic?
PostPosted: Mon Oct 04, 2010 2:18 pm 
Newbie

Joined: Fri Jul 09, 2010 1:24 pm
Posts: 11
I am searching for a similar solution and came across this post. For the sake of others, the original author posted this ticket:

http://opensource.atlassian.com/project ... e/HHH-4320

I also have a forum posting trying to resolve this as using the mappedBy attribute of OneToOne fails:

viewtopic.php?f=1&t=1002834&start=0


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.