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