-->
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: bidirectional one-to-one with join fetching
PostPosted: Wed Jul 18, 2007 9:29 pm 
Regular
Regular

Joined: Fri Feb 09, 2007 3:47 pm
Posts: 56
I am almost giving up and decided to hit the forums hoping to find an answer or at least a direction...

It seems not possible to get a 1-1 bidirectional relationship between two tables (left and right) using a join fetch strategy.

First of all, no I cant use lazy loading because I need to load an inmemory, disconnected cache from the db and lazy fetching wont work.

My main problem is that I have thousands of rows and the N+1 problem is killing me. Last time loading all the data took more than 40 mins with N selects after the initial one.

So I tried to change the fetching strategy to join left and right the problem persists, i.e. N+1. It seems that Hibernate correctly identifies both right and left entity from the join resultset row, but issues another select when resolving the property from right to left.

At this point I have a <many-to-one> on the left table and a <one-to-one> on the right table using property-ref.

My first question is: is this scenario (joined bidirectional 1-1) even supported in Hibernate? What am I doing wrong? Or are there alternatives to speed up the loading?

thanks!


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.