-->
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: Hibernate mapping with constraints
PostPosted: Wed Jan 24, 2007 6:12 am 
Newbie

Joined: Tue Dec 06, 2005 10:13 am
Posts: 17
Can I map foreign key and add additional conditions?
For example: If I have two objects: Parent, Son. Son has "active" column. I want to map between the parent and the active sons only:

Code:
<set
        name="sons"
        lazy="true"
        inverse="true"
        cascade="all-delete-orphan"
    >
        <key>
            <column name="parent_id" />
        </key>
        <one-to-many
            class="com.xxx.Son"
        />
    </set> 



Is there some property that I can add to get only the active sons?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 24, 2007 7:25 am 
Newbie

Joined: Tue Dec 12, 2006 3:19 am
Posts: 17
Location: Spain
Hello,

I'm not very sure, but that url would be useful (I hope so)

http://www.hibernate.org/hib_docs/v3/re ... lters.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 9:55 am 
Regular
Regular

Joined: Mon Jan 22, 2007 10:32 am
Posts: 101
You can also add a where attribute in set tag to filter the elements in collection.

Go through this link.

http://www.hibernate.org/hib_docs/v3/re ... tions.html


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.