-->
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: fetch=join not working map entitymode?
PostPosted: Fri Apr 13, 2007 4:55 pm 
Newbie

Joined: Mon Mar 19, 2007 7:47 pm
Posts: 6
i've specified fetch=join for a many-to-one relationship since i always need the parent entity. this gives the expected join sql in pojo mode, but in map mode, it doesn't seem to want to use a join in the sql... anyone else seen this or know if this a known issue?

here's the mapping.
<hibernate-mapping>
<class entity-name="EmpEntity" table ="EMP">
<id name="id" type="long" column="EMP_ID">
<generator class="native"/>
</id>

<property name="ename"
type="string"
length="50"
not-null="true"
column="ENAME">
</property>

<many-to-one name="dept"
entity-name="DeptEntity"
column="DEPT_ID"
not-null="true"
fetch="join">
</many-to-one>

</class>

<class entity-name="DeptEntity" table="DEPT">
<id name="id" type="long" column="DEPT_ID">
<generator class="native"/>
</id>

<property name="dname"
type="string"
length="50"
not-null="true"
column="DNAME">
</property>

<bag name="emps" inverse="true">
<key column="DEPT_ID"/>
<one-to-many entity-name="EmpEntity"/>
</bag>
</class>
</hibernate-mapping>

the query is dynSession.createQuery("from EmpEntity").list()

the emitted sql is:

Hibernate: select empentity0_.EMP_ID as EMP1_3_, empentity0_.ENAME as ENAME3_, empentity0_.DEPT_ID as DEPT3_3_ from EMP empentity0_
Hibernate: select deptentity0_.DEPT_ID as DEPT1_4_0_, deptentity0_.DNAME as DNAME4_0_ from DEPT deptentity0_ where deptentity0_.DEPT_ID=?
Hibernate: select deptentity0_.DEPT_ID as DEPT1_4_0_, deptentity0_.DNAME as DNAME4_0_ from DEPT deptentity0_ where deptentity0_.DEPT_ID=?
Hibernate: select deptentity0_.DEPT_ID as DEPT1_4_0_, deptentity0_.DNAME as DNAME4_0_ from DEPT deptentity0_ where deptentity0_.DEPT_ID=?

thanks for any help!


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.