-->
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: 7.4.2. one to one - causes N+1 selects
PostPosted: Sun Jul 16, 2006 11:51 pm 
Newbie

Joined: Tue Nov 25, 2003 4:31 pm
Posts: 12
Location: Minnesota
Hibernate version: 3.1.3


We have an immutable table, representing customer data. To add additional, application specific data, we use an optional 'extras' table in a schema which matches section 7.4.2 "A bidirectional one-to-one association on a primary key uses the special id generator".

Using the example from the docs, if the Address doesn't exists for all Persons, then in the TwoPhase load, it attempts to fetch null, one-to-one associations. While this behavior makes sense on hibernate's part, it seems like it should be avoided.

I believe there is even code in the source that's commented out about checking the persistence context if the reference is supposed to be null. We know it's null from the query and within the two-phase load-- yet it attempts to select each one from the optional extras table.

I've thought about using a <join/> instead, but I'm worried about conficts with the immutable status of the parent customer data.


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.