-->
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.  [ 1 post ] 
Author Message
 Post subject: matching columns of master and child table in bag collection
PostPosted: Fri Jan 08, 2010 12:12 pm 
Newbie

Joined: Fri Jan 08, 2010 11:54 am
Posts: 1
Hi I have a question about bag mapping.

class Parent {
private long id;//Primary key
private long dept_id ;
}

class Parent {
private long id;//Primary key
private long dept_id ;
private Parent parent;
}

the simplest forms of my classes.
I have a bag collection in parent mapping like below;

<bag name="children" table="TAB_CHILDREN" order-by="ID desc" cascade="all-delete-orphan" inverse="true" >
<key column="PARENT_ID"/>
<one-to-many class="Parent"/>
</bag>
parent.getchildren(); method generates the
select * from tab_children where parent_id= ? ; parent's id as parameter;
I want the dept_id of these tables match , i mean parent.getchildren() method generates
this sql ;
select * from tab_children where parent_id= ? and dept_id =? ; parent's id as first parameter and parent's dept_id as second parameter;

I tried to use ' where ' property of bag but i coludn't pass the dept_id of parent as parameter ;
I need this because of performance issues ,We use orcle dB and we have partitioning on dept_id columns so.

how can i get this bag definition generate second sql?


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

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.