Dear hibernate-dev,
After maaaannny googling and after someone told me (through an IRC chat) that this problem could be a bug, I finally come to you.. Explanations are given here: http://forum.hibernate.org/viewtopic.php?p=2379177 This behavior is related to polymorphic Criteria queries using a Table per class hierarchy mapping where a sub-class contains a one-to-many association (Set<UserAddress>). Here is the query and the stack trace: Hibernate: select .... All the attributs ... from User this_ inner join UserAddress useraddress1_ on this_._oid=useraddress1_._user_oid inner join UserAddress useraddress1_ on this_._oid=useraddress1_._user_oid where useraddress1_.street like ? 00:10:52,366 WARN [JDBCExceptionReporter] [main] SQL Error: 0, SQLState: 42712 00:10:52,366 WARN [JDBCExceptionReporter] [main] SQL Error: 0, SQLState: 42712 00:10:52,366 ERROR[JDBCExceptionReporter] [main] ERROR: table name "useraddress1_" specified more than once 00:10:52,366 ERROR[JDBCExceptionReporter] [main] ERROR: table name "useraddress1_" specified more than once Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2223) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) at org.hibernate.loader.Loader.list(Loader.java:2099) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at com.netguardians.ngscreener.middleware.simulator.QuerySimulator.Exec(QuerySimulator.java:163) at com.netguardians.ngscreener.middleware.simulator.QuerySimulator.main(QuerySimulator.java:60) Caused by: org.postgresql.util.PSQLException: ERROR: table name "useraddress1_" specified more than once at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:351) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:255) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1787) at org.hibernate.loader.Loader.doQuery(Loader.java:674) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2220) ... 7 more I'm using Hibernate 3.2.5.ga. When trying 3.2.6.ga (to see if I get the same result) I get the following problem (I'm using a standalone JTA implementation called BTM): http://opensource.atlassian.com/projects/hibernate/browse/HHH-3109 http://opensource.atlassian.com/projects/hibernate/browse/HHH-3110 For that problem, I think that hint would help me: "Either setup BTM to bind to JNDI or provide an implementation of org.hibernate.transaction.TransactionFactory that uses the purely standalone/in-VM BTM" But that would be the second phase ;-) Could the problem of the polymorphic query be a bug ? Or am I just missing something ? Many thanks in advance for your help and hope to read you soon, Joël _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev