-->
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.  [ 6 posts ] 
Author Message
 Post subject: Why these formulas with non-existent columns?
PostPosted: Mon Jan 23, 2006 1:38 am 
Newbie

Joined: Sat Jan 07, 2006 10:33 am
Posts: 18
Location: New York NY
Problem summary: The generated SQL for "merge" and "refresh" actions for objects that contain maps always includes "formula" clauses that refer to columns that don't exist. In the example below, the database complains because the query includes a reference to an "id" column that does not exist. I do not understand why this formula is included in the SQL, nor how to prevent it (or to cause it to refer to the right column). This problem occurs no matter what inheritance strategy I specify. (In this example I do not specify any.) Thanks for any insight.

Hibernate version: 3.1.1, Annotations 3.1beta8

Mapping documents:
Code:
@Entity
public class Project
{
    @SuppressWarnings("unused")
    @Id
    @GeneratedValue
    private Long id;

    ...

    @OneToOne(cascade = CascadeType.ALL)
    @Column(name = "`bundle`")
    private TestBundle bundle;

    ...
}

Code:
@Entity
public class TestBundle
{
    @SuppressWarnings("unused")
    @Id
    @GeneratedValue
    private Long id;

    ...

    @OneToMany(cascade = CascadeType.ALL)
    @MapKey
    @Column(name = "`testCases`")
    private Map<String, TestCase> testCases = new HashMap<String, TestCase>();
   
    @OneToMany(cascade = CascadeType.ALL)
    @MapKey
    @Column(name = "`resultMap`")
    private Map<String, AnnotatedTestResult> resultMap;
   
    @OneToMany(cascade = CascadeType.ALL)
    @Column(name = "`resultIndex`")
    @IndexColumn(name = "result_position")
    private List<AnnotatedTestResult> resultIndex;

    ...
}


Code between sessionFactory.openSession() and session.close():
(nothing special...)
Code:
session.merge(project);


Full stack trace of any exception that occurs:
Code:
Could not load an entity: [org.aitools.yycomp.Project#1] [select project0_.id as id0_2_, project0_.loaded as loaded0_2_, project0_.`name` as name3_0_2_, project0_.botid as botid0_2_, project0_.bundle_id as bundle15_0_2_, project0_.categoryMap_id as categor16_0_2_, project0_.synonymMap_id as synonymMap17_0_2_, project0_.`projectPath` as projectP5_0_2_, project0_.`testSuitePath` as testSuit6_0_2_, project0_.`testResultsPath` as testResu7_0_2_, project0_.`categoryMapPath` as category8_0_2_, project0_.`synonymMapPath` as synonymM9_0_2_, project0_.`dialoguePath` as dialogu10_0_2_, project0_.`inputAddPath` as inputAd11_0_2_, project0_.`inputDeferPath` as inputDe12_0_2_, project0_.`kbPath` as kbPath13_0_2_, project0_.`botConfigPath` as botConf14_0_2_, testbundle1_.id as id3_0_, testbundle1_.`testsuitePath` as testsuit2_3_0_, testbundle1_.`testresultsPath` as testresu3_3_0_, testbundle1_.`sortKey` as sortKey4_3_0_, testbundle1_.`sortOrder` as sortOrder5_3_0_, testcases2_.TestBundle_id as TestBundle1_4_, testcase3_.id as testCases2_4_, testcases2_.id as formula4_4_, testcase3_.id as id18_1_, testcase3_.`name` as name2_18_1_, testcase3_.`input` as input3_18_1_, testcase3_.`lastResponse` as lastResp4_18_1_, resultmap4_.TestBundle_id as TestBundle1_5_, resultmap4_.resultMap_id as resultMap4_5_, resultmap4_.id as formula3_5_ from Project project0_ left outer join TestBundle testbundle1_ on project0_.bundle_id=testbundle1_.id left outer join TestBundle_TestCase testcases2_ on testbundle1_.id=testcases2_.TestBundle_id left outer join TestCase testcase3_ on testcases2_.testCases_id=testcase3_.id left outer join TestBundle_AnnotatedTestResult resultmap4_ on testbundle1_.id=resultmap4_.TestBundle_id where project0_.id=?]
java.sql.SQLException: Unknown column 'testcases2_.id' in 'field list'
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
   at org.hibernate.loader.Loader.doQuery(Loader.java:662)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
   at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
   at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
   at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
   at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
   at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
   at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
   at org.hibernate.impl.SessionImpl.get(SessionImpl.java:826)
   at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:209)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:100)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:52)
   at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:699)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:683)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:687)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
   at $Proxy19.merge(Unknown Source)
   at org.aitools.webapp.servlet.ProjectBasedServlet.setupAndForward(ProjectBasedServlet.java:36)
   at org.aitools.webapp.servlet.ApplicationServlet.doGet(ApplicationServlet.java:33)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.MenuFilter.doFilter(MenuFilter.java:41)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.ProjectRoleFilter.doFilter(ProjectRoleFilter.java:57)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.RequireProjectLoadedFilter.doFilter(RequireProjectLoadedFilter.java:53)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.RequireProjectFilter.doFilter(RequireProjectFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:514)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
SQL Error: 1054, SQLState: 42S22
Unknown column 'testcases2_.id' in 'field list'
Error performing load command
org.hibernate.exception.SQLGrammarException: could not load an entity: [org.aitools.yycomp.Project#1]
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
   at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
   at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
   at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
   at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
   at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
   at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
   at org.hibernate.impl.SessionImpl.get(SessionImpl.java:826)
   at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:209)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:100)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:52)
   at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:699)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:683)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:687)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
   at $Proxy19.merge(Unknown Source)
   at org.aitools.webapp.servlet.ProjectBasedServlet.setupAndForward(ProjectBasedServlet.java:36)
   at org.aitools.webapp.servlet.ApplicationServlet.doGet(ApplicationServlet.java:33)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.MenuFilter.doFilter(MenuFilter.java:41)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.ProjectRoleFilter.doFilter(ProjectRoleFilter.java:57)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.RequireProjectLoadedFilter.doFilter(RequireProjectLoadedFilter.java:53)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.RequireProjectFilter.doFilter(RequireProjectFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:514)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Unknown column 'testcases2_.id' in 'field list'
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
   at org.hibernate.loader.Loader.doQuery(Loader.java:662)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
   ... 53 more
Servlet.service() for servlet EditCategoryMapServlet threw exception
org.hibernate.exception.SQLGrammarException: could not load an entity: [org.aitools.yycomp.Project#1]
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
   at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
   at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
   at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
   at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
   at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
   at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
   at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
   at org.hibernate.impl.SessionImpl.get(SessionImpl.java:826)
   at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:209)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:100)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:52)
   at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:699)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:683)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:687)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
   at $Proxy19.merge(Unknown Source)
   at org.aitools.webapp.servlet.ProjectBasedServlet.setupAndForward(ProjectBasedServlet.java:36)
   at org.aitools.webapp.servlet.ApplicationServlet.doGet(ApplicationServlet.java:33)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.MenuFilter.doFilter(MenuFilter.java:41)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.ProjectRoleFilter.doFilter(ProjectRoleFilter.java:57)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.RequireProjectLoadedFilter.doFilter(RequireProjectLoadedFilter.java:53)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.aitools.webapp.filter.RequireProjectFilter.doFilter(RequireProjectFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:514)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Unknown column 'testcases2_.id' in 'field list'
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
   at org.hibernate.loader.Loader.doQuery(Loader.java:662)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.loadEntity(Loader.java:1785)
   ... 53 more


Name and version of the database you are using: MySQL 4.1.16

The generated SQL (show_sql=true):
Code:
Static select for action ACTION_MERGE on entity org.aitools.yycomp.TestBundle: select testbundle0_.id as id3_1_, testbundle0_.`testsuitePath` as testsuit2_3_1_, testbundle0_.`testresultsPath` as testresu3_3_1_, testbundle0_.`sortKey` as sortKey4_3_1_, testbundle0_.`sortOrder` as sortOrder5_3_1_, testcases1_.TestBundle_id as TestBundle1_3_, testcase2_.id as testCases2_3_, testcases1_.id as formula4_3_, testcase2_.id as id18_0_, testcase2_.`name` as name2_18_0_, testcase2_.`input` as input3_18_0_, testcase2_.`lastResponse` as lastResp4_18_0_, checkers3_.TestCase_id as TestCase1_4_, checkers3_.checkers__id as checkers2_4_ from TestBundle testbundle0_ left outer join TestBundle_TestCase testcases1_ on testbundle0_.id=testcases1_.TestBundle_id left outer join TestCase testcase2_ on testcases1_.testCases_id=testcase2_.id left outer join TestCase_Checker checkers3_ on testcase2_.id=checkers3_.TestCase_id where testbundle0_.id=?
Static select for action ACTION_REFRESH on entity org.aitools.yycomp.TestBundle: select testbundle0_.id as id3_1_, testbundle0_.`testsuitePath` as testsuit2_3_1_, testbundle0_.`testresultsPath` as testresu3_3_1_, testbundle0_.`sortKey` as sortKey4_3_1_, testbundle0_.`sortOrder` as sortOrder5_3_1_, testcases1_.TestBundle_id as TestBundle1_3_, testcase2_.id as testCases2_3_, testcases1_.id as formula4_3_, testcase2_.id as id18_0_, testcase2_.`name` as name2_18_0_, testcase2_.`input` as input3_18_0_, testcase2_.`lastResponse` as lastResp4_18_0_, checkers3_.TestCase_id as TestCase1_4_, checkers3_.checkers__id as checkers2_4_ from TestBundle testbundle0_ left outer join TestBundle_TestCase testcases1_ on testbundle0_.id=testcases1_.TestBundle_id left outer join TestCase testcase2_ on testcases1_.testCases_id=testcase2_.id left outer join TestCase_Checker checkers3_ on testcase2_.id=checkers3_.TestCase_id where testbundle0_.id=?

and the problematic query itself...
Code:
select project0_.id as id0_2_, project0_.loaded as loaded0_2_, project0_.`name` as name3_0_2_, project0_.botid as botid0_2_, project0_.bundle_id as bundle15_0_2_, project0_.categoryMap_id as categor16_0_2_, project0_.synonymMap_id as synonymMap17_0_2_, project0_.`projectPath` as projectP5_0_2_, project0_.`testSuitePath` as testSuit6_0_2_, project0_.`testResultsPath` as testResu7_0_2_, project0_.`categoryMapPath` as category8_0_2_, project0_.`synonymMapPath` as synonymM9_0_2_, project0_.`dialoguePath` as dialogu10_0_2_, project0_.`inputAddPath` as inputAd11_0_2_, project0_.`inputDeferPath` as inputDe12_0_2_, project0_.`kbPath` as kbPath13_0_2_, project0_.`botConfigPath` as botConf14_0_2_, testbundle1_.id as id3_0_, testbundle1_.`testsuitePath` as testsuit2_3_0_, testbundle1_.`testresultsPath` as testresu3_3_0_, testbundle1_.`sortKey` as sortKey4_3_0_, testbundle1_.`sortOrder` as sortOrder5_3_0_, testcases2_.TestBundle_id as TestBundle1_4_, testcase3_.id as testCases2_4_, testcases2_.id as formula4_4_, testcase3_.id as id18_1_, testcase3_.`name` as name2_18_1_, testcase3_.`input` as input3_18_1_, testcase3_.`lastResponse` as lastResp4_18_1_, resultmap4_.TestBundle_id as TestBundle1_5_, resultmap4_.resultMap_id as resultMap4_5_, resultmap4_.id as formula3_5_ from Project project0_ left outer join TestBundle testbundle1_ on project0_.bundle_id=testbundle1_.id left outer join TestBundle_TestCase testcases2_ on testbundle1_.id=testcases2_.TestBundle_id left outer join TestCase testcase3_ on testcases2_.testCases_id=testcase3_.id left outer join TestBundle_AnnotatedTestResult resultmap4_ on testbundle1_.id=resultmap4_.TestBundle_id where project0_.id=?


Debug level Hibernate log excerpt:
Code:
opened session at timestamp: 11379936303
allowing method [beginTransaction] in non-transacted context
begin
opening JDBC connection
total checked-out connections: 0
using pooled JDBC connection, pool size: 0
current autocommit status: false
after transaction begin
id unsaved-value: null
detached instance of: org.aitools.yycomp.Project
merging detached instance
loading entity: [org.aitools.yycomp.Project#1]
attempting to resolve: [org.aitools.yycomp.Project#1]
object not resolved in any cache: [org.aitools.yycomp.Project#1]
Fetching entity: [org.aitools.yycomp.Project#1]
loading entity: [org.aitools.yycomp.Project#1]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select project0_.id as id0_2_, project0_.loaded as loaded0_2_, project0_.`name` as name3_0_2_, project0_.botid as botid0_2_, project0_.bundle_id as bundle15_0_2_, project0_.categoryMap_id as categor16_0_2_, project0_.synonymMap_id as synonymMap17_0_2_, project0_.`projectPath` as projectP5_0_2_, project0_.`testSuitePath` as testSuit6_0_2_, project0_.`testResultsPath` as testResu7_0_2_, project0_.`categoryMapPath` as category8_0_2_, project0_.`synonymMapPath` as synonymM9_0_2_, project0_.`dialoguePath` as dialogu10_0_2_, project0_.`inputAddPath` as inputAd11_0_2_, project0_.`inputDeferPath` as inputDe12_0_2_, project0_.`kbPath` as kbPath13_0_2_, project0_.`botConfigPath` as botConf14_0_2_, testbundle1_.id as id3_0_, testbundle1_.`testsuitePath` as testsuit2_3_0_, testbundle1_.`testresultsPath` as testresu3_3_0_, testbundle1_.`sortKey` as sortKey4_3_0_, testbundle1_.`sortOrder` as sortOrder5_3_0_, testcases2_.TestBundle_id as TestBundle1_4_, testcase3_.id as testCases2_4_, testcases2_.id as formula4_4_, testcase3_.id as id18_1_, testcase3_.`name` as name2_18_1_, testcase3_.`input` as input3_18_1_, testcase3_.`lastResponse` as lastResp4_18_1_, resultmap4_.TestBundle_id as TestBundle1_5_, resultmap4_.resultMap_id as resultMap4_5_, resultmap4_.id as formula3_5_ from Project project0_ left outer join TestBundle testbundle1_ on project0_.bundle_id=testbundle1_.id left outer join TestBundle_TestCase testcases2_ on testbundle1_.id=testcases2_.TestBundle_id left outer join TestCase testcase3_ on testcases2_.testCases_id=testcase3_.id left outer join TestBundle_AnnotatedTestResult resultmap4_ on testbundle1_.id=resultmap4_.TestBundle_id where project0_.id=?
Hibernate: select project0_.id as id0_2_, project0_.loaded as loaded0_2_, project0_.`name` as name3_0_2_, project0_.botid as botid0_2_, project0_.bundle_id as bundle15_0_2_, project0_.categoryMap_id as categor16_0_2_, project0_.synonymMap_id as synonymMap17_0_2_, project0_.`projectPath` as projectP5_0_2_, project0_.`testSuitePath` as testSuit6_0_2_, project0_.`testResultsPath` as testResu7_0_2_, project0_.`categoryMapPath` as category8_0_2_, project0_.`synonymMapPath` as synonymM9_0_2_, project0_.`dialoguePath` as dialogu10_0_2_, project0_.`inputAddPath` as inputAd11_0_2_, project0_.`inputDeferPath` as inputDe12_0_2_, project0_.`kbPath` as kbPath13_0_2_, project0_.`botConfigPath` as botConf14_0_2_, testbundle1_.id as id3_0_, testbundle1_.`testsuitePath` as testsuit2_3_0_, testbundle1_.`testresultsPath` as testresu3_3_0_, testbundle1_.`sortKey` as sortKey4_3_0_, testbundle1_.`sortOrder` as sortOrder5_3_0_, testcases2_.TestBundle_id as TestBundle1_4_, testcase3_.id as testCases2_4_, testcases2_.id as formula4_4_, testcase3_.id as id18_1_, testcase3_.`name` as name2_18_1_, testcase3_.`input` as input3_18_1_, testcase3_.`lastResponse` as lastResp4_18_1_, resultmap4_.TestBundle_id as TestBundle1_5_, resultmap4_.resultMap_id as resultMap4_5_, resultmap4_.id as formula3_5_ from Project project0_ left outer join TestBundle testbundle1_ on project0_.bundle_id=testbundle1_.id left outer join TestBundle_TestCase testcases2_ on testbundle1_.id=testcases2_.TestBundle_id left outer join TestCase testcase3_ on testcases2_.testCases_id=testcase3_.id left outer join TestBundle_AnnotatedTestResult resultmap4_ on testbundle1_.id=resultmap4_.TestBundle_id where project0_.id=?
preparing statement
binding '1' to parameter: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
could not load an entity: [org.aitools.yycomp.Project#1] [select project0_.id as id0_2_, project0_.loaded as loaded0_2_, project0_.`name` as name3_0_2_, project0_.botid as botid0_2_, project0_.bundle_id as bundle15_0_2_, project0_.categoryMap_id as categor16_0_2_, project0_.synonymMap_id as synonymMap17_0_2_, project0_.`projectPath` as projectP5_0_2_, project0_.`testSuitePath` as testSuit6_0_2_, project0_.`testResultsPath` as testResu7_0_2_, project0_.`categoryMapPath` as category8_0_2_, project0_.`synonymMapPath` as synonymM9_0_2_, project0_.`dialoguePath` as dialogu10_0_2_, project0_.`inputAddPath` as inputAd11_0_2_, project0_.`inputDeferPath` as inputDe12_0_2_, project0_.`kbPath` as kbPath13_0_2_, project0_.`botConfigPath` as botConf14_0_2_, testbundle1_.id as id3_0_, testbundle1_.`testsuitePath` as testsuit2_3_0_, testbundle1_.`testresultsPath` as testresu3_3_0_, testbundle1_.`sortKey` as sortKey4_3_0_, testbundle1_.`sortOrder` as sortOrder5_3_0_, testcases2_.TestBundle_id as TestBundle1_4_, testcase3_.id as testCases2_4_, testcases2_.id as formula4_4_, testcase3_.id as id18_1_, testcase3_.`name` as name2_18_1_, testcase3_.`input` as input3_18_1_, testcase3_.`lastResponse` as lastResp4_18_1_, resultmap4_.TestBundle_id as TestBundle1_5_, resultmap4_.resultMap_id as resultMap4_5_, resultmap4_.id as formula3_5_ from Project project0_ left outer join TestBundle testbundle1_ on project0_.bundle_id=testbundle1_.id left outer join TestBundle_TestCase testcases2_ on testbundle1_.id=testcases2_.TestBundle_id left outer join TestCase testcase3_ on testcases2_.testCases_id=testcase3_.id left outer join TestBundle_AnnotatedTestResult resultmap4_ on testbundle1_.id=resultmap4_.TestBundle_id where project0_.id=?]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 6:07 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Read carefully the documentation about @MapKey

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 10:27 am 
Newbie

Joined: Sat Jan 07, 2006 10:33 am
Posts: 18
Location: New York NY
emmanuel wrote:
Read carefully the documentation about @MapKey

Yes, I forgot to mention that I tried various things with @MapKey as well. The documentation I found is at http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.html#d0e1063 and says:
Quote:
EJB3 allows you to map Maps using as a key one of the target entity property using @MapKey(name="myProperty") (myProperty is a property name in the target entity). When using @MapKey (without property name), the target entity primary key is used.

Since all of my target entities do have properties named "id", I though maybe the default behavior would work. But it does not. I also tried setting things like:

Code:
@MapKey(name = "input")

where "input" is the named of another property of the target entity, but I get the same complaint about the formula.
In any case the formula refers to a column that does not exist, in the table generated by Hibernate. For instance, in the error above, the problematic formula says

Code:
testcases2_.id as formula4_4_

where "testcases2_" is the table "TestBundle_TestCase". But the Hibernate-generated SQL that creates that table is:

Code:
create table TestBundle_TestCase (TestBundle_id bigint not null, testCases_id bigint not null, primary key (TestBundle_id, testCases_id), unique (testCases_id))

(Sorry, should have included that too.) So there is no "id" column. I tried doing

Code:
@MapKey(name = "testCases_id")

just to see if that would work, but of course then there is a complaint that the TestCase class does not have a "testCases_id" member.
So I don't know how to get around this problem--it seems like the code that generates the "merge" query is not aware of the definition of the tables it uses. I hope that I am just misunderstanding something....


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 8:01 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you actually have a collection of elements (you should use @CollectionOfElements BTW), so the element does not have any id hence the default does not work

I don't have the mapping of TestCase so I can only guess.

Maybe the MapKey algorithm has a hole for collection of elements. Try to minimize the testcase to 1 Entity and 1 collection of elements and a map key referencing a property of this composite element. If it fails, put it to JIRa, I'll check it and fix it.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: requested info/test
PostPosted: Tue Jan 24, 2006 3:33 pm 
Newbie

Joined: Sat Jan 07, 2006 10:33 am
Posts: 18
Location: New York NY
emmanuel wrote:
you actually have a collection of elements (you should use @CollectionOfElements BTW), so the element does not have any id hence the default does not work

I don't have the mapping of TestCase so I can only guess.

Maybe the MapKey algorithm has a hole for collection of elements. Try to minimize the testcase to 1 Entity and 1 collection of elements and a map key referencing a property of this composite element. If it fails, put it to JIRa, I'll check it and fix it.

OK, I have created a simple case and I get the same problem. I ran into another question/problem using @CollectionOfElements (it seems that there is no option for any cascading behavior on it -- see related post), so I am manually saving the child and then the parent.

The mappings:
Code:
@Entity
public class Parent
{
    @Id
    @GeneratedValue
    private Long id;

    @CollectionOfElements
    @MapKey
    private Map<String, Child> children = new HashMap<String, Child>();
   
    public Parent(){}
   
    public void addChild(Child child)
    {
        this.children.put("" + System.currentTimeMillis(), child);
    }
   
    public Map<String, Child> getChildren()
    {
        return this.children;
    }
}

Code:
@Entity
public class Child
{
    @Id
    @GeneratedValue
    private Long id;
   
    public Child() {}
}


The test:
Code:
        Parent parent = new Parent();
        Child child = new Child();
        parent.addChild(child);

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        Transaction tx = session.beginTransaction();
        session.save(child);
        session.save(parent);
        tx.commit();
       
        session = HibernateUtil.getSessionFactory().getCurrentSession();
        tx = session.beginTransaction();
        session.merge(parent);
        tx.commit();

It fails on the attempt to merge, because the generated SQL refers to a column that does not exist (in the table created by the earlier generated SQL). Here is the exception:
Code:
could not initialize a collection: [org.aitools.Parent.children#1] [select children0_.Parent_id as Parent1_1_, children0_.children_id as children2_1_, children0_.id as formula0_1_, child1_.id as id1_0
_ from Parent_Child children0_ left outer join Child child1_ on children0_.children_id=child1_.id where children0_.Parent_id=?]
java.sql.SQLException: Unknown column 'children0_.id' in 'field list'
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
   at org.hibernate.loader.Loader.doQuery(Loader.java:662)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
   at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
   at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
   at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
   at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1693)
   at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
   at org.hibernate.collection.AbstractPersistentCollection.write(AbstractPersistentCollection.java:183)
   at org.hibernate.collection.PersistentMap.clear(PersistentMap.java:181)
   at org.hibernate.type.MapType.replaceElements(MapType.java:66)
   at org.hibernate.type.CollectionType.replace(CollectionType.java:437)
   at org.hibernate.type.TypeFactory.replace(TypeFactory.java:431)
   at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:281)
   at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:247)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:100)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:52)
   at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:699)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:683)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:687)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
   at $Proxy8.merge(Unknown Source)
   at org.aitools.TestServlet.doGet(TestServlet.java:40)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
SQL Error: 1054, SQLState: 42S22
Unknown column 'children0_.id' in 'field list'
Servlet.service() for servlet TestServlet threw exception
org.hibernate.exception.SQLGrammarException: could not initialize a collection: [org.aitools.Parent.children#1]
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.loader.Loader.loadCollection(Loader.java:1926)
   at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
   at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
   at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
   at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1693)
   at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
   at org.hibernate.collection.AbstractPersistentCollection.write(AbstractPersistentCollection.java:183)
   at org.hibernate.collection.PersistentMap.clear(PersistentMap.java:181)
   at org.hibernate.type.MapType.replaceElements(MapType.java:66)
   at org.hibernate.type.CollectionType.replace(CollectionType.java:437)
   at org.hibernate.type.TypeFactory.replace(TypeFactory.java:431)
   at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:281)
   at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:247)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:100)
   at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:52)
   at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:699)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:683)
   at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:687)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
   at $Proxy8.merge(Unknown Source)
   at org.aitools.TestServlet.doGet(TestServlet.java:40)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Unknown column 'children0_.id' in 'field list'
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
   at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
   at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
   at org.hibernate.loader.Loader.doQuery(Loader.java:662)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
   ... 40 more

Here's the generated SQL:
Code:
Static SQL for entity: org.aitools.Parent
Version select: select id from Parent where id =?
Snapshot select: select parent_.id from Parent parent_ where parent_.id=?
Insert 0: insert into Parent (id) values (?)
Update 0: null
Delete 0: delete from Parent where id=?
Identity insert: insert into Parent values ( )
Static SQL for entity: org.aitools.Child
Version select: select id from Child where id =?
Snapshot select: select child_.id from Child child_ where child_.id=?
Insert 0: insert into Child (id) values (?)
Update 0: null
Delete 0: delete from Child where id=?
Identity insert: insert into Child values ( )
Static SQL for collection: org.aitools.Parent.children
Row insert: insert into Parent_Child (Parent_id, children_id) values (?, ?)
Row update: update Parent_Child set children_id=? where Parent_id=? and children_id=?
Row delete: delete from Parent_Child where Parent_id=? and children_id=?
One-shot delete: delete from Parent_Child where Parent_id=?
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=? for update
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=? for update
Static select for action ACTION_MERGE on entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for action ACTION_REFRESH on entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=? for update
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=? for update
Static select for action ACTION_MERGE on entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for action ACTION_REFRESH on entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for collection org.aitools.Parent.children: select children0_.Parent_id as Parent1_1_, children0_.children_id as children2_1_, children0_.id as formula0_1_, child1_.id as id1_0_ from Par
ent_Child children0_ left outer join Child child1_ on children0_.children_id=child1_.id where children0_.Parent_id=?

Here's the whole Hibernate debug output:
Code:
Hibernate 3.1.1
hibernate.properties not found
using CGLIB reflection optimizer
using JDK 1.4 java.sql.Timestamp handling
configuring from resource: /hibernate.cfg.xml
Configuration resource: /hibernate.cfg.xml
trying to locate http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath under org/hibernate/
found http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.password=WERUIOWERUOIWER
hibernate.connection.url=jdbc:mysql:///hibernatetest
hibernate.connection.username=test
connection.pool_size=1
hibernate.dialect=org.hibernate.dialect.MySQLDialect
current_session_context_class=thread
cache.provider_class=org.hibernate.cache.NoCacheProvider
show_sql=true
hbm2ddl.auto=create
hibernate.current_session_context_class=thread
null<-org.dom4j.tree.DefaultAttribute@6cb8 [Attribute: name class value "org.aitools.Parent"]
null<-org.dom4j.tree.DefaultAttribute@ee22f7 [Attribute: name class value "org.aitools.Child"]
Configured SessionFactory: null
properties: {show_sql=true, java.vendor=Sun Microsystems Inc., catalina.base=/home/noel/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1, hibernate.connection.url=jdbc:mysql:///hibernatet
est, sun.management.compiler=HotSpot Client Compiler, catalina.useNaming=true, hbm2ddl.auto=create, os.name=Linux, sun.boot.class.path=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/rt.jar:/usr/lib/jvm/
java-1.5.0-sun-1.5.0.05/jre/lib/i18n.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/jsse.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/
jce.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/charsets.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/classes, hibernate.current_session_context_class=thread, sun.desktop=gnome, java.vm.specifica
tion.vendor=Sun Microsystems Inc., java.runtime.version=1.5.0_05-b05, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, user.name=noel, shared.loader=${catalina.base}/shared/classes,
${catalina.base}/shared/lib/*.jar, tomcat.util.buf.StringCache.byte.enabled=true, current_session_context_class=thread, user.language=en, java.naming.factory.initial=org.apache.naming.java.javaURLCont
extFactory, sun.boot.library.path=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386, java.version=1.5.0_05, user.timezone=America/New_York, sun.arch.data.model=32, java.endorsed.dirs=/usr/local/tomcat
5/common/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., fil
e.separator=/, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=49.0, user.country=US, java.home=/usr/lib/jvm/java-1.5.0-sun-1
.5.0.05/jre, java.vm.info=mixed mode, sharing, os.version=2.6.14-1.1656_FC4, path.separator=:, java.vm.version=1.5.0_05-b05, hibernate.connection.password=WERUIOWERUOIWER, java.awt.printerjob=sun.prin
t.PSPrinterJob, sun.io.unicode.encoding=UnicodeLittle, hibernate.connection.username=test, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,
java.naming.factory.url.pkgs=org.apache.naming, user.home=/home/noel, java.specification.vendor=Sun Microsystems Inc., hibernate.hbm2ddl.auto=create, java.library.path=/usr/lib/jvm/java-1.5.0-sun-1.5.
0.05/jre/lib/i386/client:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/../lib/i386:/usr/lib/mozilla-1.7.12, java.vendor.url=http://java.sun.com/, hibernate
.connection.driver_class=com.mysql.jdbc.Driver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.MySQLDialect, common.loader=${catalina.home}/common/classes,${catalina.hom
e}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=/usr/local/tomcat5/bi
n/bootstrap.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/lib/tools.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=/usr/local/tomcat5,
sun.cpu.endian=little, sun.os.patch.level=unknown, connection.pool_size=1, java.io.tmpdir=/tmp, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=${catalina.home}/server/cla
sses,${catalina.home}/server/lib/*.jar, os.arch=i386, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.ext.dirs=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/ext, user.dir=/home/noel, line.sep
arator=
, java.vm.name=Java HotSpot(TM) Client VM, cache.provider_class=org.hibernate.cache.NoCacheProvider, file.encoding=UTF-8, java.specification.version=1.5, hibernate.show_sql=true, hibernate.connection.
pool_size=1}
Preparing to build session factory with filters : {}
Execute first pass mapping processing
Process hbm files
Process annotated classes
Binding entity from annotated class: org.aitools.Parent
Binding column TYPE unique false
Import with entity name=Parent
Bind entity org.aitools.Parent on table Parent
Processing org.aitools.Parent per property annotation
Processing org.aitools.Parent per field annotation
Processing annotations of org.aitools.Parent.id
Binding column id unique false
id is an id
building SimpleValue for id
Building property id
Cascading id with null
Bind @Id on id
Processing annotations of org.aitools.Parent.children
Binding column null unique false
Binding column children unique false
Binding column null unique false
Binding column null unique false
Binding column null unique false
Collection role: org.aitools.Parent.children
Building property children
Cascading children with null
ResourceBundle ValidatorMessages not found. Delegate to org.hibernate.validator.resources.DefaultValidatorMessages
Binding entity from annotated class: org.aitools.Child
Binding column TYPE unique false
Import with entity name=Child
Bind entity org.aitools.Child on table Child
Processing org.aitools.Child per property annotation
Processing org.aitools.Child per field annotation
Processing annotations of org.aitools.Child.id
Binding column id unique false
id is an id
building SimpleValue for id
Building property id
Cascading id with null
Bind @Id on id
ResourceBundle ValidatorMessages not found. Delegate to org.hibernate.validator.resources.DefaultValidatorMessages
processing manytoone fk mappings
processing extends queue
processing collection mappings
Second pass for collection: org.aitools.Parent.children
Binding a OneToMany: org.aitools.Parent.children through an association table
Mapped collection key: Parent_id, index: id, element: children_id
processing native query and ResultSetMapping mappings
processing association property references
processing foreign key constraints
resolving reference to class: org.aitools.Child
resolving reference to class: org.aitools.Parent
Using Hibernate built-in connection pool (not for production use!)
Hibernate connection pool size: 1
autocommit mode: false
using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///hibernatetest
connection properties: {user=test, password=WERUIOWERUOIWER}
total checked-out connections: 0
opening new JDBC connection
created connection to: jdbc:mysql:///hibernatetest, Isolation Level: 4
RDBMS: MySQL, version: 4.1.16-log
JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.12 ( $Date: 2005-11-17 15:53:48 +0100 (Thu, 17 Nov 2005) $, $Revision$ )
returning connection to pool, pool size: 1
Using dialect: org.hibernate.dialect.MySQLDialect
Using default transaction strategy (direct JDBC transactions)
No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Automatic flush during beforeCompletion(): disabled
Automatic session close at end of transaction: disabled
JDBC batch size: 15
JDBC batch updates for versioned data: disabled
Scrollable result sets: enabled
Wrap result sets: disabled
JDBC3 getGeneratedKeys(): enabled
Connection release mode: auto
Maximum outer join fetch depth: 2
Default batch fetch size: 1
Generate SQL with comments: disabled
Order SQL updates by primary key: disabled
Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Using ASTQueryTranslatorFactory
Query language substitutions: {}
Second-level cache: enabled
Query cache: disabled
Cache provider: org.hibernate.cache.NoCacheProvider
Optimize cache for minimal puts: disabled
Structured second-level cache entries: disabled
Using dialect defined converter
Echoing all SQL to stdout
Statistics: disabled
Deleted entity synthetic identifier rollback: disabled
Default entity-mode: pojo
building session factory
Session factory constructed with filter configurations : {}
instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., show_sql=true, catalina.base=/home/noel/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1, hibernate.conn
ection.url=jdbc:mysql:///hibernatetest, sun.management.compiler=HotSpot Client Compiler, catalina.useNaming=true, os.name=Linux, hbm2ddl.auto=create, sun.boot.class.path=/usr/lib/jvm/java-1.5.0-sun-1.
5.0.05/jre/lib/rt.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i18n.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/jsse.jar:/usr/lib/j
vm/java-1.5.0-sun-1.5.0.05/jre/lib/jce.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/charsets.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/classes, hibernate.current_session_context_class=thread, s
un.desktop=gnome, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.5.0_05-b05, hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider, user.name=noel, shared.load
er=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, tomcat.util.buf.StringCache.byte.enabled=true, current_session_context_class=thread, user.language=en, java.naming.factory.initial
=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386, java.version=1.5.0_05, user.timezone=America/New_York, sun.arch.data.model=32, j
ava.endorsed.dirs=/usr/local/tomcat5/common/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.
,org.apache.jasper.,sun.beans., file.separator=/, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=49.0, user.country=US, java
.home=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre, java.vm.info=mixed mode, sharing, os.version=2.6.14-1.1656_FC4, path.separator=:, java.vm.version=1.5.0_05-b05, hibernate.connection.password=WERUIOWERU
OIWER, java.awt.printerjob=sun.print.PSPrinterJob, sun.io.unicode.encoding=UnicodeLittle, hibernate.connection.username=test, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.
apache.tomcat.,org.apache.jasper., java.naming.factory.url.pkgs=org.apache.naming, user.home=/home/noel, java.specification.vendor=Sun Microsystems Inc., hibernate.hbm2ddl.auto=create, java.library.pa
th=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386/client:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/../lib/i386:/usr/lib/mozilla-1.7.12, java.vendor.
url=http://java.sun.com/, hibernate.connection.driver_class=com.mysql.jdbc.Driver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=org.hibernate.dialect.MySQLDialect, common.loader=${catalina.
home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, ja
va.class.path=/usr/local/tomcat5/bin/bootstrap.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/lib/tools.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0,
catalina.home=/usr/local/tomcat5, sun.cpu.endian=little, sun.os.patch.level=unknown, connection.pool_size=1, java.io.tmpdir=/tmp, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server
.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar, os.arch=i386, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.ext.dirs=/usr/lib/jvm/java-1.5.0-sun-1.5.0.05/jre/lib
/ext, user.dir=/home/noel, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, cache.provider_class=org.hibernate.cache.NoCacheProvider, file.encoding=UTF-8, java.specification.version=1.5, hibernate.connection.pool_size=1, hibernate.sh
ow_sql=true}
Static SQL for entity: org.aitools.Parent
Version select: select id from Parent where id =?
Snapshot select: select parent_.id from Parent parent_ where parent_.id=?
Insert 0: insert into Parent (id) values (?)
Update 0: null
Delete 0: delete from Parent where id=?
Identity insert: insert into Parent values ( )
Static SQL for entity: org.aitools.Child
Version select: select id from Child where id =?
Snapshot select: select child_.id from Child child_ where child_.id=?
Insert 0: insert into Child (id) values (?)
Update 0: null
Delete 0: delete from Child where id=?
Identity insert: insert into Child values ( )
Static SQL for collection: org.aitools.Parent.children
Row insert: insert into Parent_Child (Parent_id, children_id) values (?, ?)
Row update: update Parent_Child set children_id=? where Parent_id=? and children_id=?
Row delete: delete from Parent_Child where Parent_id=? and children_id=?
One-shot delete: delete from Parent_Child where Parent_id=?
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=? for update
Static select for entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=? for update
Static select for action ACTION_MERGE on entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for action ACTION_REFRESH on entity org.aitools.Parent: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=? for update
Static select for entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=? for update
Static select for action ACTION_MERGE on entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for action ACTION_REFRESH on entity org.aitools.Child: select child0_.id as id1_0_ from Child child0_ where child0_.id=?
Static select for collection org.aitools.Parent.children: select children0_.Parent_id as Parent1_1_, children0_.children_id as children2_1_, children0_.id as formula0_1_, child1_.id as id1_0_ from Par
ent_Child children0_ left outer join Child child1_ on children0_.children_id=child1_.id where children0_.Parent_id=?
initializing class SessionFactoryObjectFactory
registered: ff80808108fde2af0108fde2b3cf0000 (unnamed)
Not binding factory to JNDI, no JNDI name configured
instantiated session factory
Execute first pass mapping processing
Process hbm files
Process annotated classes
processing manytoone fk mappings
processing extends queue
processing collection mappings
processing native query and ResultSetMapping mappings
processing association property references
processing foreign key constraints
resolving reference to class: org.aitools.Child
resolving reference to class: org.aitools.Parent
Execute first pass mapping processing
Process hbm files
Process annotated classes
processing manytoone fk mappings
processing extends queue
processing collection mappings
processing native query and ResultSetMapping mappings
processing association property references
processing foreign key constraints
resolving reference to class: org.aitools.Child
resolving reference to class: org.aitools.Parent
Running hbm2ddl schema export
import file not found: /import.sql
exporting generated schema to database
total checked-out connections: 0
using pooled JDBC connection, pool size: 0
alter table Parent_Child drop foreign key FK5AF11D472EC2DFD2
alter table Parent_Child drop foreign key FK5AF11D473026197F
drop table if exists Child
drop table if exists Parent
drop table if exists Parent_Child
create table Child (id bigint not null auto_increment, primary key (id))
create table Parent (id bigint not null auto_increment, primary key (id))
create table Parent_Child (Parent_id bigint not null, children_id bigint not null, primary key (Parent_id, children_id), unique (children_id))
alter table Parent_Child add index FK5AF11D472EC2DFD2 (children_id), add constraint FK5AF11D472EC2DFD2 foreign key (children_id) references Child (id)
alter table Parent_Child add index FK5AF11D473026197F (Parent_id), add constraint FK5AF11D473026197F foreign key (Parent_id) references Parent (id)
schema export complete
returning connection to pool, pool size: 1
Checking 0 named HQL queries
Checking 0 named SQL queries
opened session at timestamp: 11381308622
allowing method [beginTransaction] in non-transacted context
begin
opening JDBC connection
total checked-out connections: 0
using pooled JDBC connection, pool size: 0
current autocommit status: false
after transaction begin
saving transient instance
saving [org.aitools.Child#<null>]
executing insertions
Inserting entity: org.aitools.Child (native id)
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
insert into Child values ( )
Hibernate: insert into Child values ( )
preparing statement
Dehydrating entity: [org.aitools.Child#<null>]
Natively generated identity: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
saving transient instance
saving [org.aitools.Parent#<null>]
executing insertions
Wrapped collection in role: org.aitools.Parent.children
Inserting entity: org.aitools.Parent (native id)
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
insert into Parent values ( )
Hibernate: insert into Parent values ( )
preparing statement
Dehydrating entity: [org.aitools.Parent#<null>]
Natively generated identity: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
commit
automatically flushing session
flushing session
processing flush-time cascades
dirty checking collections
Flushing entities and processing referenced collections
Collection found: [org.aitools.Parent.children#1], was: [<unreferenced>] (initialized)
Processing unreferenced collections
Scheduling collection removes/(re)creates/updates
Flushed: 0 insertions, 0 updates, 0 deletions to 2 objects
Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
listing entities:
org.aitools.Child{id=1}
org.aitools.Parent{children=[org.aitools.Child#1], id=1}
executing flush
Inserting collection: [org.aitools.Parent.children#1]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
insert into Parent_Child (Parent_id, children_id) values (?, ?)
Hibernate: insert into Parent_Child (Parent_id, children_id) values (?, ?)
preparing statement
binding '1' to parameter: 1
binding '1' to parameter: 2
Adding to batch
done inserting collection: 1 rows inserted
Executing batch size: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
post flush
before transaction completion
before transaction completion
committed JDBC Connection
after transaction completion
aggressively releasing JDBC connection
releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
returning connection to pool, pool size: 1
after transaction completion
automatically closing session
closing session
connection already null in cleanup : no action
opened session at timestamp: 11381308626
allowing method [beginTransaction] in non-transacted context
begin
opening JDBC connection
total checked-out connections: 0
using pooled JDBC connection, pool size: 0
current autocommit status: false
after transaction begin
id unsaved-value: null
detached instance of: org.aitools.Parent
merging detached instance
loading entity: [org.aitools.Parent#1]
attempting to resolve: [org.aitools.Parent#1]
object not resolved in any cache: [org.aitools.Parent#1]
Fetching entity: [org.aitools.Parent#1]
loading entity: [org.aitools.Parent#1]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
Hibernate: select parent0_.id as id0_0_ from Parent parent0_ where parent0_.id=?
preparing statement
binding '1' to parameter: 1
about to open ResultSet (open ResultSets: 0, globally: 0)
processing result set
result set row: 0
result row: EntityKey[org.aitools.Parent#1]
Initializing object from ResultSet: [org.aitools.Parent#1]
Hydrating entity: [org.aitools.Parent#1]
done processing result set (1 rows)
about to close ResultSet (open ResultSets: 1, globally: 1)
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
total objects hydrated: 1
resolving associations for [org.aitools.Parent#1]
creating collection wrapper:[org.aitools.Parent.children#1]
done materializing entity [org.aitools.Parent#1]
initializing non-lazy collections
done entity load
initializing collection [org.aitools.Parent.children#1]
checking second-level cache
collection not cached
loading collection: [org.aitools.Parent.children#1]
about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
select children0_.Parent_id as Parent1_1_, children0_.children_id as children2_1_, children0_.id as formula0_1_, child1_.id as id1_0_ from Parent_Child children0_ left outer join Child child1_ on chil
dren0_.children_id=child1_.id where children0_.Parent_id=?
Hibernate: select children0_.Parent_id as Parent1_1_, children0_.children_id as children2_1_, children0_.id as formula0_1_, child1_.id as id1_0_ from Parent_Child children0_ left outer join Child chil
d1_ on children0_.children_id=child1_.id where children0_.Parent_id=?
preparing statement
binding '1' to parameter: 1
about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
closing statement
could not initialize a collection: [org.aitools.Parent.children#1] [select children0_.Parent_id as Parent1_1_, children0_.children_id as children2_1_, children0_.id as formula0_1_, child1_.id as id1_0
_ from Parent_Child children0_ left outer join Child child1_ on children0_.children_id=child1_.id where children0_.Parent_id=?]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 2:54 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
dupe already answered somewhere else

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.