-->
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.  [ 3 posts ] 
Author Message
 Post subject: One-to-many + typed one-to-one on the same table
PostPosted: Mon May 14, 2007 7:02 am 
Newbie

Joined: Mon May 14, 2007 6:52 am
Posts: 3
Dear all,

I've two tables: Project and ProjectVersion; a Project can have many Versions and this relationship works like a charm with one-to-many relationship provided by Hibernate:

Code:
<set name="versions" lazy="true" inverse="true">
   <key column="project_id"/>
   <one-to-many class="dao.ProjectVersion"/>
</set>


Of all the versions for a given project one and only one would be marked as "default" version. That is, version table has an additional flag called is_default.

My question is how would I map this default version such that Project.getDefaultVersion() returns me an instance of ProjectVersion class representing the default version.

Thanks in advance for your help.

ATTA


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 15, 2007 12:04 pm 
Newbie

Joined: Mon May 14, 2007 6:52 am
Posts: 3
Any takers, please?

Thanks.

ATTA


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 16, 2007 11:59 pm 
Newbie

Joined: Mon May 14, 2007 6:52 am
Posts: 3
for those interested in solution:

http://www.onjava.com/pub/a/onjava/2005/08/03/hibernate.html?page=4

HTH.

ATTA


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.