-->
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: (N+1) selects – Hibernate bug?
PostPosted: Tue Oct 30, 2007 10:55 am 
Newbie

Joined: Sun Sep 30, 2007 6:50 pm
Posts: 8
I tried all possible combinations to prevent (N+1), nothing works.

Our mapping looks like:
-------------------------------------------
<class “User” lazy=”false”>
<many-to-one name="security" cascade="lock" column="SECURITYID" class="Security" not-null="false" lazy="no-proxy" access="field">
</many-to-one>
<set name="history" lazy="true" cascade="save-update,lock" inverse="true">
<key column="USERID" not-null="true"/>
<one-to-many class="History"/>
</set>
<one-to-one name="profile" class="Profile" cascade="save-update,lock" lazy="no-proxy" access="field"/>
</class>

<class “History” lazy=”false”>
<many-to-one name="user" cascade="lock" column="USERID" class="User" not-null="true" lazy="no-proxy" access="field">
</many-to-one>
</class>
-------------------------------------------------

retrieveUser(userid) -- retrieves everything in one JOIN, which is fine.
retrieveHistory(historyid) – generating 3-SQLs (one JOIN-fine, 2-extra selects one
on User.Profile & one on User.Security.

How to prevent SELECTs on Profile & Security.
This is really affecting performance. I also tried with other LAZY options on User.Security&Profile, varying fetch_depth, but nothing works.
Our client is very upset, don’t want to use Hibernate any more!
I would appreciate your help.

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.