-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: One-To-One Filter Applied, Non-Lazy Fetch Problem
PostPosted: Wed Jun 03, 2009 4:38 am 
Beginner
Beginner

Joined: Wed Aug 22, 2007 5:53 am
Posts: 38
Suppose i have one-to-one association between Product and ProductBasic. and we have applied filter on ProductBasic Class.
I have applied this filter as in Java side we have one-to-one relationship between Product and ProductBasic BUT at database side
we have one-to-many relationship between PRODUCT and PRODUCTBASIC. and we apply a condition (STARTTIME < CURRETTIME < ENDTIME)
while fetching PRODUCTBASIC, and this will always give me one record out of many.
So i have put this condition as filter in ProductBasic class.

In current hibernate, one-to-one associations are always non-lazily fetched. Moreover it doesn't apply filter conditions.
I understand that it can;t apply filter condition as some filter parameter must be provided at runtime and
user may not provide them (as he is not asking for ProductBasic)... Also in this case, proper proxy can't be created as
until we apply the filter criteria, we won't get one ProductBasic row (among many)..

I think hibernate code should be changed so that if a filter is declared on the associated class (ProductBasic in our case),
hibernate should return null for ProductBasic.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.