-->
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.  [ 2 posts ] 
Author Message
 Post subject: AddJoin doesn't work with SQLQuery
PostPosted: Thu Oct 27, 2005 12:16 pm 
Newbie

Joined: Wed Oct 26, 2005 4:50 am
Posts: 6
Hibernate version:
3.1

Mapping documents:
<class name="com.inet.dao.Lctqtcp2" table="LCTQTCP2" schema="LANCELOT">
<composite-id name="id" class="com.inet.dao.Lctqtcp2Id">
<key-property name="cpId" type="character">
<column name="CP_ID" length="1" />
</key-property>
<key-property name="leId" type="string">
<column name="LE_ID" length="32" />
</key-property>
</composite-id>
<many-to-one name="lctqtle1" class="com.inet.dao.Lctqtle1" update="false" insert="false" fetch="select">
<column name="LE_ID" length="32" not-null="true" />
</many-to-one>
<many-to-one name="lctqtcp1" class="com.inet.dao.Lctqtcp1" update="false" insert="false" fetch="select">
<column name="CP_ID" length="1" not-null="true" />
</many-to-one>
</class>

Full stack trace of any exception that occurs:
Hibernate: SELECT cp2.*, le1.* FROM Lctqtcp2 cp2, Lctqtle1 le1 WHERE cp2.LE_ID=le1.LE_ID
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object;


Hi,

I would like to have the same result with this request

session.createCriteria(Lctqtcp2.class).setFetchMode("lctqtle1", FetchMode.JOIN).list() >OK


and this another one but it doesn't work ??? Why not ? addJoin ?

session.createSQLQuery("SELECT cp2.*, le1.* FROM Lctqtcp2 cp2, Lctqtle1 le1 WHERE cp2.LE_ID=le1.LE_ID")
.addEntity(Lctqtcp2.class)
.addJoin("Lctqtle1","Lctqtcp2.lctqtle1")
.list(); > KO


Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 3:43 am 
Newbie

Joined: Wed Oct 26, 2005 4:50 am
Posts: 6
Sorry, it was not an error... code is ok.. no problems...

Just addJoin add 2 object by list's elements (each by entity)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.