-->
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: Using Discriminator for OneToMany annotation
PostPosted: Fri Oct 19, 2007 5:21 am 
Newbie

Joined: Tue Apr 24, 2007 7:59 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version:[/b]

[b]Mapping documents:[/b]

[b]Code between sessionFactory.openSession() and session.close():[/b]

[b]Full stack trace of any exception that occurs:[/b]

[b]Name and version of the database you are using:[/b]

[b]The generated SQL (show_sql=true):[/b]

[b]Debug level Hibernate log excerpt:[/b]


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html

In my model we have 4 Set<Integer> and we want this list to be populated according to some specific type. I know it is possible if i define the targetEntity in onetomany mapping but in that case i have create Four extra class. I just want to avoid creating these four extra classes. Is there sone solution so that i can define some kind discriminator at onetomany annotation and it populates the correct set depanding upon the discriminator value. Please help.....
Manoj


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 24, 2007 7:49 am 
Regular
Regular

Joined: Mon Jan 22, 2007 10:32 am
Posts: 101
Though I feel it is really unfair on your part to expect a solution/ reply without providing any significant information (mapping, class structure, etc.) yet...

You can add a where clause in set that would restrict the elements in set. something like

<set name="restrictedSet" table="table" where="discrimnatorColumn='Type1'">
<key column="ID"/>
<one-to-many class="anotherClass" column="_ID"/>
</set>

_________________
Please rate this post if you find it helpful


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.