Forums Register Login

one-to-one with property-ref always non-lazy

+Pie Number of slices to send: Send
I have one-to-one relationship between Product and ProductBasic.

PRODUCT ------> PRODUCTID(PK)
PRODUCT ------> PID, CODE, STARTTIME (Composite-key) and PID is FK

In product.hbm.xml
<one-to-one name="productBasic" cascade="save-update" property-ref="activeProduct" constrained="true">
<formula>PRODUCTID</formula>
</one-to-one>


ProductBasic.hbm.xml as :
<properties name="activeProduct">
<many-to-one name="product" class="Product" insert="false" update="false" lazy="proxy" />
</properties>


When i am using property-ref, and try to load all Products, it fetches ProductBasic also as :
select * from PRODUCT; //suppose it return 2 records with productId as 100 and 101 respectively.
select * from PRODUCTBASIC where productId='100'
select * from PRODUCTBASIC where productId='101'

How can i fetch ProductBasic in a Non-Lazy manner in this case.
+Pie Number of slices to send: Send
Any Update on this ?
Those are the largest trousers in the world! Especially when next to this ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 772 times.
Similar Threads
One-to-one:property-ref to a part of composite-key
Part of Composite-Id is foreign Key:How specify in Mapping?
Mapping Associations using composite-key element ,property-ref attribute and <formula> element
"Left join Fetch" "With Clause" Required
Critial Problem with one-to-one association.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:49:56.