Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any Update on this ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic