one-to-one with property-ref always non-lazy
--------------------------------------------
Key: HHH-3927
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3927
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.1
Reporter: Sandeep Vaid
I have one-to-one relationship between 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.
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira