DZone Forums
Go Back   DZone Forums > Community > Languages & Frameworks > Java
Reload this Page one-to-one with property-ref always non-lazy
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Mar 2009
Default one-to-one with property-ref always non-lazy - 04-30-2009, 03:02 AM

I have one-to-one relationship betnwee Product and ProductBasic.


<one-to-one name="productBasic" cascade="save-update" property-ref="activeProduct" lazy="proxy">
<formula>'1'</formula>
<formula>PRODUCTID</formula>
</one-to-one>


ProductBasic.hbm.xml as :
<properties name="activeProduct">
<property name="Code" column="CODE"></property>
<property name="pId" column="PID" insert="false" update="false"></property>
</properties>


When i am using property-ref, and try to load Product, it eagerly fetches ProductBasic also as :

select *
from PRODUCT productbo0_ left outer join PRODUCTPERIOD productbas1_ on '18'=productbas1_.CODE and productbo0_.PID=productbas1_.PID where productbo0_.PID=?

NOTE: Along with Product, ProductBasic is also fetched in a single query.

Even if i add constrained="true" in one-to-one mapping, the query gets fired as :
select * from PRODUCT productbo0_ where productbo0_.PID=?
select * from PRODUCTBASIC productbas0_ where productbas0_.CODE=? and productbas0_.PID=?

NOTE: Along with Product, ProductBasic is also fetched in a different query.

BUT in both these cases, ProductBasic is fetched always (non-lazy)..

How can i fetch ProductBasic in a Non-Lazy manner in this case.one-to-one with property-ref always non-lazy
Reply With Quote
  (#2 (permalink)) Old
Member
 
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Mar 2009
Default 05-26-2009, 08:50 AM

I have this requirement because i use filter on ProductBasic. and now when this ProductBasic is fetched always (non-lazyly) it doesn't
apply my filter.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Property View Label Provider herciu.adrian Eclipse 1 05-19-2009 07:24 AM
swing UI & property prefixes xcolwell Java 0 01-02-2009 03:53 PM
BeanUtils populate for indexed property exception edmund Java 0 12-30-2008 09:28 PM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com