posted 15 years ago
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.