-->
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: batch-size on class
PostPosted: Tue May 11, 2010 10:56 am 
Newbie

Joined: Mon Jul 18, 2005 6:35 am
Posts: 9
I have the class :
Code:
/** @hibernate.class table="ENT" dynamic-update="true" dynamic-insert="true" batch-size="20" */
public class Ent {
   private String aprop;
   private Ent parentEnt;

/** @hibernate.many-to-one not-null="false" outer-join="false" @hibernate.column name="PARENT_ID" */
public Ent getParentEnt() {return parentEnt;}
public void setParentEnt(Ent parentEnt) {
   this.parentEnt = parentEnt;
}

/** @hibernate.property column="aprop" not-null="false" */
public String getAprop(){ return aprop;}
public void setAprop(String aprop){ this.aprop= aprop;}

}

When i ....("select ent from Ent ent where ent.aprop = 'something' ").list();
it will bring 10 ent-ities (there are 10 ent with aprop = "something") + the parentEnt (for each ent)
=> 1 sql for the 10 ent-tities
+ 10 sql for parent ent-tities

is there a way to tell hibernate to bring the parents using just one query.
i put the batch-size="20" but this is not working (i've checked the hbm file and the batch-size it's there)
I do not want to use lazy="true" - I'm using hibernate 2.1.6

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.