-->
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: Realod function in a join query
PostPosted: Wed Feb 01, 2006 4:12 am 
Newbie

Joined: Wed Nov 02, 2005 6:07 am
Posts: 12
I have table A (customer) and table B (customerExtras) with a one-on-one relationship. In the mapping file of table A there is following entry:

Code:
<many-to-one name="customerExtras" lazy="false" not-found="ignore"  cascade="none" class="CustomerExtras" insert="false" update="false">
              <column name="bp_cd"  />
              <column name="bp_ods_cd"/>
              <column name="cust_nb"/>
</many-to-one> 


I use the criteria API to search table A:

Code:
Criteria crit = sess.createCriteria(Customer.class)
.setFetchMode("customerExtras", FetchMode.JOIN)
.createAlias("customerExtras", "customerExtras")
...


The statement works fine but for every entry in table A which has no entry in table B a separated select-statement is send to the database. Can someone please explain me the reason for that behaviour and how I can turn it off?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 5:25 am 
Newbie

Joined: Wed Jan 11, 2006 5:21 am
Posts: 14
You can try setting the lazy="no-proxy"

Quote:
<many-to-one name="customerExtras" lazy="no-proxy" not-found="ignore" cascade="none" class="CustomerExtras" insert="false" update="false">
<column name="bp_cd" />
<column name="bp_ods_cd"/>
<column name="cust_nb"/>
</many-to-one>


Kind regards,
roy
please don't forget to give credit.


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.