-->
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: Criteria object generating erroneous SQL
PostPosted: Tue Jun 29, 2004 1:20 am 
Regular
Regular

Joined: Thu Jan 29, 2004 10:34 am
Posts: 52
Location: Austin, TX
not to be a nuisanse but i'm restarting the thread from http://forum.hibernate.org/viewtopic.php?t=932115&highlight= due to a severe drop visibility :-).

consider A-->B-->C as a many-to-one mapping. i use an mpath like "b.c" to form criteria objets (where the root is A.class and b,c represent A.getB() and B.getC()). now the sql generated is fine in this case.

this whole thing blows up with the message
Quote:
Not unique
when A has a joined subclass A'.

Code:
java.sql.SQLException: Invalid argument value,  message from server: "Not unique table/alias: 'x0_'"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:1874)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1538)
   at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
   at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
   at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
   at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
   at net.sf.hibernate.loader.Loader.doList(Loader.java:950)
   at net.sf.hibernate.loader.Loader.list(Loader.java:941)
   at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3571)
   at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:223)


if anyone can hint if this is a bug or a usage... please let me know.

thanks
ravi


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.