• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any Update on this ?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic