-->
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: Erreur de cast avec addJoin sur SQLQuery
PostPosted: Thu Oct 27, 2005 9:58 am 
Newbie

Joined: Wed Oct 26, 2005 4:50 am
Posts: 6
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1

Mapping documents:
<class name="com.inetpsa.dao.Lctqtcp2" table="LCTQTCP2" schema="LANCELOT">
<composite-id name="id" class="com.inetpsa.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.inetpsa.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.inetpsa.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;


Bonjour,

J'aimerai obtenir le même résultat que cette requette

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



avec celle - ci mais je n' y arrive pas.. ??? Pourquoi ? 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



Merci...


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

Joined: Wed Oct 26, 2005 4:50 am
Posts: 6
Je m'excuse mais j'ai mal interprété mon code...

addJoin ajoute un objet supplémentaire dans l'élément de la liste...

un object par entité (d'ou mon problème de cast...)


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.