Hello, all.
This is happening since I decided to change the mapping strategy from table per class hierarchy to table per subclass, using joined-subclass (it worked first).
Hibernate version:
3.1.3 (auto download by maven from ibiblio)
Mapping documents:
FOR CLASS DOCUMENT:
<hibernate-mapping default-lazy="false">
<!--
DOCUMENT
=============================================
-->
<class table="process_document" name="org.helianto.process.Document">
<meta attribute="class-description" inherit="false">
<![CDATA[
<p>
A base class to any class that requires version control.
</p>
<p>
Tipical descendants are parts, processes and organizational process
documents.
</p>
@author ...
]]>
</meta>
<!--
id
-->
<id name="id" type="long" unsaved-value="null">
<generator class="native" />
</id>
<!--
parent entity
-->
<natural-id>
<many-to-one name="entity" class="org.helianto.core.Entity"
cascade="save-update,merge" fetch="select">
<meta attribute="use-in-equals">true</meta>
<meta attribute="use-in-tostring">true</meta>
<column name="entityId"/>
</many-to-one>
<!--
document code
-->
<property name="docCode" type="string">
<meta attribute="use-in-equals">true</meta>
<meta attribute="use-in-tostring">true</meta>
<column name="docCode" length="24"/>
</property>
</natural-id>
<!--
document name
-->
<property name="docName" type="string" length="128" />
</class>
</hibernate-mapping>
FOR CLASS EXTERNAL DOCUMENT:
<hibernate-mapping default-lazy="false">
<joined-subclass
name="org.helianto.process.ExternalDocument"
table="process_documentext_m3"
extends="org.helianto.process.Document">
<!--
EXTERNAL DOCUMENT
=============================================
-->
<meta attribute="class-description" inherit="false">
<![CDATA[
<p>
Documents to be stored appart from the datastore.
</p>
@author ...
]]>
</meta>
<key column="externalId" />
<!--
document url
-->
<property name="docUrl" type="string" length="64" />
<!--
document type
-->
<property name="docType" type="char"/>
<!--
parent
-->
<many-to-one name="parent" cascade="save-update,merge"
fetch="select"
class="org.helianto.process.ExternalDocument">
<column name="parentId" not-null="false" />
</many-to-one>
</joined-subclass>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
I do not handle sessionFactory directly, but use spring's abstraction represented by the class HibernateTemplate. Thus, I have a dao like:
public class ProcessDaoImpl extends MaterialDaoImpl implements ProcessDao {
...
public List<ExternalDocument> findExternalDocumentByParent(ExternalDocument parent) {
return (ArrayList<ExternalDocument>) find(EXTERNALDOCUMENT_PARENT_QRY, parent);
}
....
static final String EXTERNALDOCUMENT_PARENT_QRY = "from ExternalDocument externalDocument " +
"where externalDocument.parent = ? ";
...
where the super class "find" method makes the connection to the hibernate template.
Full stack trace of any exception that occurs:
DEBUG --- ConnectionManager.openConnection(415) | opening JDBC connection
DEBUG --- JDBCTransaction.begin(59) | current autocommit status: false
DEBUG --- JDBCContext.afterTransactionBegin(194) | after transaction begin
DEBUG --- HibernateTransactionManager.doBegin(530) | Exposing Hibernate transaction as JDBC transaction [org.apache.commons.dbcp.PoolableConnection@623367]
DEBUG --- TransactionSynchronizationManager.bindResource(159) | Bound value [org.springframework.jdbc.datasource.ConnectionHolder@1e514a9] for key [org.apache.commons.dbcp.BasicDataSource@3deff3] to thread [http-8080-Processor24]
DEBUG --- TransactionSynchronizationManager.bindResource(159) | Bound value [org.springframework.orm.hibernate3.SessionHolder@af8b32] for key [org.hibernate.impl.SessionFactoryImpl@62be97] to thread [http-8080-Processor24]
DEBUG --- TransactionSynchronizationManager.initSynchronization(211) | Initializing transaction synchronization
DEBUG --- LightweightDaoImpl.find(112) | ** DAO finding [from ExternalDocument externalDocument where externalDocument.parent = ? ] with [Ljava.lang.Object;@dbbe8b
DEBUG --- TransactionSynchronizationManager.getResource(134) | Retrieved value [org.springframework.orm.hibernate3.SessionHolder@af8b32] for key [org.hibernate.impl.SessionFactoryImpl@62be97] bound to thread [http-8080-Processor24]
DEBUG --- QueryPlanCache.getHQLQueryPlan(69) | unable to locate HQL query plan in cache; generating (from ExternalDocument externalDocument where externalDocument.parent = ? )
DEBUG --- QueryTranslatorImpl.parse(236) | parse() - HQL: from org.helianto.process.ExternalDocument externalDocument where externalDocument.parent = ?
DEBUG --- QueryTranslatorImpl.showHqlAst(252) | --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| \-[FROM] 'from'
| \-[RANGE] 'RANGE'
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[IDENT] 'org'
| | | | \-[IDENT] 'helianto'
| | | \-[IDENT] 'process'
| | \-[IDENT] 'ExternalDocument'
| \-[ALIAS] 'externalDocument'
\-[WHERE] 'where'
\-[EQ] '='
+-[DOT] '.'
| +-[IDENT] 'externalDocument'
| \-[IDENT] 'parent'
\-[PARAM] '?'
DEBUG --- ErrorCounter.throwQueryException(68) | throwQueryException() : no errors
DEBUG --- HqlSqlBaseWalker.beforeStatement(111) | select << begin [level=1, statement=select]
DEBUG --- FromElement.doInitialize(104) | FromClause{level=1} : org.helianto.process.ExternalDocument (externalDocument) -> externaldo0_
DEBUG --- FromReferenceNode.setResolved(51) | Resolved : externalDocument -> externaldo0_.externalId
DEBUG --- DotNode.getDataType(541) | getDataType() : parent -> org.hibernate.type.ManyToOneType(org.helianto.process.ExternalDocument)
DEBUG --- DotNode.dereferenceEntityIdentifier(497) | dereferenceShortcut() : property parent in org.helianto.process.ExternalDocument does not require a join.
DEBUG --- FromReferenceNode.setResolved(51) | Resolved : externalDocument.parent -> externaldo0_.parentId
DEBUG --- HqlSqlBaseWalker.beforeStatementCompletion(117) | select : finishing up [level=1, statement=select]
DEBUG --- HqlSqlWalker.processQuery(511) | processQuery() : ( SELECT ( FromClause{level=1} process_documentext_m3 externaldo0_ ) ( where ( = ( externaldo0_.parentId externaldo0_.externalId parent ) ? ) ) )
DEBUG --- HqlSqlWalker.createSelectClauseFromFromClause(713) | Derived SELECT clause created.
DEBUG --- JoinProcessor.addJoinNodes(128) | Using FROM fragment [process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id]
DEBUG --- HqlSqlBaseWalker.afterStatementCompletion(123) | select >> end [level=1, statement=select]
DEBUG --- QueryTranslatorImpl.analyze(222) | --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (process_document,process_documentext_m3)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'externaldo0_.externalId as id6_' {FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=externalDocument,role=null,tableName=process_documentext_m3,tableAlias=externaldo0_,origin=null,colums={,className=org.helianto.process.ExternalDocument}}}
| \-[SQL_TOKEN] SqlFragment: 'externaldo0_1_.entityId as entityId6_, externaldo0_1_.docCode as docCode6_, externaldo0_1_.docName as docName6_, externaldo0_.docUrl as docUrl36_, externaldo0_.docType as docType36_, externaldo0_.parentId as parentId36_'
+-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[externalDocument], fromElementByTableAlias=[externaldo0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=externalDocument,role=null,tableName=process_documentext_m3,tableAlias=externaldo0_,origin=null,colums={,className=org.helianto.process.ExternalDocument}}
\-[WHERE] SqlNode: 'where'
\-[EQ] BinaryLogicOperatorNode: '='
+-[DOT] DotNode: 'externaldo0_.parentId' {propertyName=parent,dereferenceType=ROOT_LEVEL,propertyPath=parent,path=externalDocument.parent,tableAlias=externaldo0_,className=org.helianto.process.ExternalDocument,classAlias=externalDocument}
| +-[ALIAS_REF] IdentNode: 'externaldo0_.externalId' {alias=externalDocument, className=org.helianto.process.ExternalDocument, tableAlias=externaldo0_}
| \-[IDENT] IdentNode: 'parent' {originalText=parent}
\-[PARAM] ParameterNode: '?' {ordinal=0, expectedType=org.hibernate.type.ManyToOneType(org.helianto.process.ExternalDocument)}
DEBUG --- ErrorCounter.throwQueryException(68) | throwQueryException() : no errors
DEBUG --- QueryTranslatorImpl.generate(206) | HQL: from org.helianto.process.ExternalDocument externalDocument where externalDocument.parent = ?
DEBUG --- QueryTranslatorImpl.generate(207) | SQL: select externaldo0_.externalId as id6_, externaldo0_1_.entityId as entityId6_, externaldo0_1_.docCode as docCode6_, externaldo0_1_.docName as docName6_, externaldo0_.docUrl as docUrl36_, externaldo0_.docType as docType36_, externaldo0_.parentId as parentId36_ from process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id where externaldo0_.parentId=?
DEBUG --- ErrorCounter.throwQueryException(68) | throwQueryException() : no errors
DEBUG --- HQLQueryPlan.buildParameterMetadata(219) | HQL param location recognition took 0 mills (from ExternalDocument externalDocument where externalDocument.parent = ? )
DEBUG --- LightweightDaoImpl.queryAssembler(100) | Parameter 1=org.helianto.process.ExternalDocument@b7c8a07e [entity='org.helianto.core.Entity@85e43aaa [operator='org.helianto.core.Operator@760cbbd9 [operatorName='CAMFER' ]' alias='CAMFER' ]' docCode='815041-1159733481504' ]
DEBUG --- QueryPlanCache.getHQLQueryPlan(75) | located HQL query plan in cache (from ExternalDocument externalDocument where externalDocument.parent = ? )
DEBUG --- HQLQueryPlan.performList(148) | find: from ExternalDocument externalDocument where externalDocument.parent = ?
DEBUG --- QueryParameters.traceParameters(256) | parameters: [org.helianto.process.ExternalDocument#1]
DEBUG --- QueryParameters.traceParameters(262) | named parameters: {}
DEBUG --- AbstractBatcher.logOpenPreparedStatement(311) | about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG --- AbstractBatcher.log(346) | select externaldo0_.externalId as id6_, externaldo0_1_.entityId as entityId6_, externaldo0_1_.docCode as docCode6_, externaldo0_1_.docName as docName6_, externaldo0_.docUrl as docUrl36_, externaldo0_.docType as docType36_, externaldo0_.parentId as parentId36_ from process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id where externaldo0_.parentId=?
Hibernate: select externaldo0_.externalId as id6_, externaldo0_1_.entityId as entityId6_, externaldo0_1_.docCode as docCode6_, externaldo0_1_.docName as docName6_, externaldo0_.docUrl as docUrl36_, externaldo0_.docType as docType36_, externaldo0_.parentId as parentId36_ from process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id where externaldo0_.parentId=?
DEBUG --- AbstractBatcher.getPreparedStatement(424) | preparing statement
DEBUG --- IdentifierValue$3.isUnsaved(61) | id unsaved-value strategy NULL
DEBUG --- NullableType.nullSafeSet(80) | binding '1' to parameter: 1
DEBUG --- AbstractBatcher.logOpenResults(327) | about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG --- Loader.doQuery(682) | processing result set
DEBUG --- Loader.doQuery(687) | result set row: 0
DEBUG --- NullableType.nullSafeGet(122) | returning '2' as column: id6_
DEBUG --- Loader.getRow(1164) | result row: EntityKey[org.helianto.process.ExternalDocument#2]
DEBUG --- Loader.loadFromResultSet(1347) | Initializing object from ResultSet: [org.helianto.process.ExternalDocument#2]
DEBUG --- AbstractEntityPersister.hydrate(1860) | Hydrating entity: [org.helianto.process.ExternalDocument#2]
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: entityId6_
DEBUG --- NullableType.nullSafeGet(122) | returning '815052-1159733481505' as column: docCode6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docName6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docUrl36_
DEBUG --- NullableType.nullSafeGet(122) | returning 'A' as column: docType36_
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: parentId36_
DEBUG --- Loader.doQuery(687) | result set row: 1
DEBUG --- NullableType.nullSafeGet(122) | returning '3' as column: id6_
DEBUG --- Loader.getRow(1164) | result row: EntityKey[org.helianto.process.ExternalDocument#3]
DEBUG --- Loader.loadFromResultSet(1347) | Initializing object from ResultSet: [org.helianto.process.ExternalDocument#3]
DEBUG --- AbstractEntityPersister.hydrate(1860) | Hydrating entity: [org.helianto.process.ExternalDocument#3]
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: entityId6_
DEBUG --- NullableType.nullSafeGet(122) | returning '815053-1159733481505' as column: docCode6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docName6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docUrl36_
DEBUG --- NullableType.nullSafeGet(122) | returning 'A' as column: docType36_
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: parentId36_
DEBUG --- Loader.doQuery(687) | result set row: 2
DEBUG --- NullableType.nullSafeGet(122) | returning '4' as column: id6_
DEBUG --- Loader.getRow(1164) | result row: EntityKey[org.helianto.process.ExternalDocument#4]
DEBUG --- Loader.loadFromResultSet(1347) | Initializing object from ResultSet: [org.helianto.process.ExternalDocument#4]
DEBUG --- AbstractEntityPersister.hydrate(1860) | Hydrating entity: [org.helianto.process.ExternalDocument#4]
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: entityId6_
DEBUG --- NullableType.nullSafeGet(122) | returning '815054-1159733481505' as column: docCode6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docName6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docUrl36_
DEBUG --- NullableType.nullSafeGet(122) | returning 'A' as column: docType36_
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: parentId36_
DEBUG --- Loader.doQuery(687) | result set row: 3
DEBUG --- NullableType.nullSafeGet(122) | returning '5' as column: id6_
DEBUG --- Loader.getRow(1164) | result row: EntityKey[org.helianto.process.ExternalDocument#5]
DEBUG --- Loader.loadFromResultSet(1347) | Initializing object from ResultSet: [org.helianto.process.ExternalDocument#5]
DEBUG --- AbstractEntityPersister.hydrate(1860) | Hydrating entity: [org.helianto.process.ExternalDocument#5]
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: entityId6_
DEBUG --- NullableType.nullSafeGet(122) | returning '815055-1159733481505' as column: docCode6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docName6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docUrl36_
DEBUG --- NullableType.nullSafeGet(122) | returning 'A' as column: docType36_
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: parentId36_
DEBUG --- Loader.doQuery(687) | result set row: 4
DEBUG --- NullableType.nullSafeGet(122) | returning '6' as column: id6_
DEBUG --- Loader.getRow(1164) | result row: EntityKey[org.helianto.process.ExternalDocument#6]
DEBUG --- Loader.loadFromResultSet(1347) | Initializing object from ResultSet: [org.helianto.process.ExternalDocument#6]
DEBUG --- AbstractEntityPersister.hydrate(1860) | Hydrating entity: [org.helianto.process.ExternalDocument#6]
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: entityId6_
DEBUG --- NullableType.nullSafeGet(122) | returning '815056-1159733481505' as column: docCode6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docName6_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: docUrl36_
DEBUG --- NullableType.nullSafeGet(122) | returning 'A' as column: docType36_
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: parentId36_
DEBUG --- Loader.doQuery(709) | done processing result set (5 rows)
DEBUG --- AbstractBatcher.logCloseResults(334) | about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG --- AbstractBatcher.logClosePreparedStatement(319) | about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG --- AbstractBatcher.closePreparedStatement(470) | closing statement
DEBUG --- Loader.initializeEntitiesAndCollections(839) | total objects hydrated: 5
DEBUG --- TwoPhaseLoad.initializeEntity(107) | resolving associations for [org.helianto.process.ExternalDocument#2]
DEBUG --- DefaultLoadEventListener.proxyOrLoad(153) | loading entity: [org.helianto.core.Entity#1]
DEBUG --- DefaultLoadEventListener.doLoad(304) | attempting to resolve: [org.helianto.core.Entity#1]
DEBUG --- DefaultLoadEventListener.doLoad(340) | object not resolved in any cache: [org.helianto.core.Entity#1]
DEBUG --- AbstractEntityPersister.load(2723) | Fetching entity: [org.helianto.core.Entity#1]
DEBUG --- Loader.loadEntity(1777) | loading entity: [org.helianto.core.Entity#1]
DEBUG --- AbstractBatcher.logOpenPreparedStatement(311) | about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG --- AbstractBatcher.log(346) | select entity0_.id as id32_0_, entity0_.operatorId as operatorId32_0_, entity0_.alias as alias32_0_, entity0_.businessName as business5_32_0_, entity0_.identityId as identityId32_0_, entity0_.type as type32_0_ from core_entity_m3 entity0_ where entity0_.id=?
Hibernate: select entity0_.id as id32_0_, entity0_.operatorId as operatorId32_0_, entity0_.alias as alias32_0_, entity0_.businessName as business5_32_0_, entity0_.identityId as identityId32_0_, entity0_.type as type32_0_ from core_entity_m3 entity0_ where entity0_.id=?
DEBUG --- AbstractBatcher.getPreparedStatement(424) | preparing statement
DEBUG --- NullableType.nullSafeSet(80) | binding '1' to parameter: 1
DEBUG --- AbstractBatcher.logOpenResults(327) | about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG --- Loader.doQuery(682) | processing result set
DEBUG --- Loader.doQuery(687) | result set row: 0
DEBUG --- Loader.getRow(1164) | result row: EntityKey[org.helianto.core.Entity#1]
DEBUG --- NullableType.nullSafeGet(122) | returning '0' as column: type32_0_
DEBUG --- Loader.loadFromResultSet(1347) | Initializing object from ResultSet: [org.helianto.core.Entity#1]
DEBUG --- AbstractEntityPersister.hydrate(1860) | Hydrating entity: [org.helianto.core.Entity#1]
DEBUG --- NullableType.nullSafeGet(122) | returning '1' as column: operatorId32_0_
DEBUG --- NullableType.nullSafeGet(122) | returning 'CAMFER' as column: alias32_0_
DEBUG --- Loader.doQuery(709) | done processing result set (1 rows)
DEBUG --- AbstractBatcher.logCloseResults(334) | about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG --- AbstractBatcher.logClosePreparedStatement(319) | about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG --- AbstractBatcher.closePreparedStatement(470) | closing statement
DEBUG --- Loader.initializeEntitiesAndCollections(839) | total objects hydrated: 1
DEBUG --- TwoPhaseLoad.initializeEntity(107) | resolving associations for [org.helianto.core.Entity#1]
DEBUG --- DefaultLoadEventListener.proxyOrLoad(153) | loading entity: [org.helianto.core.Operator#1]
DEBUG --- DefaultLoadEventListener.doLoad(304) | attempting to resolve: [org.helianto.core.Operator#1]
DEBUG --- DefaultLoadEventListener.doLoad(340) | object not resolved in any cache: [org.helianto.core.Operator#1]
DEBUG --- AbstractEntityPersister.load(2723) | Fetching entity: [org.helianto.core.Operator#1]
DEBUG --- Loader.loadEntity(1777) | loading entity: [org.helianto.core.Operator#1]
DEBUG --- AbstractBatcher.logOpenPreparedStatement(311) | about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG --- AbstractBatcher.log(346) | select operator0_.id as id40_1_, operator0_.operatorName as operator2_40_1_, operator0_.parentId as parentId40_1_, operator0_.locale as locale40_1_, operator0_.operationMode as operatio5_40_1_, operator1_.id as id40_0_, operator1_.operatorName as operator2_40_0_, operator1_.parentId as parentId40_0_, operator1_.locale as locale40_0_, operator1_.operationMode as operatio5_40_0_ from core_operator_m3 operator0_ left outer join core_operator_m3 operator1_ on operator0_.parentId=operator1_.id where operator0_.id=?
Hibernate: select operator0_.id as id40_1_, operator0_.operatorName as operator2_40_1_, operator0_.parentId as parentId40_1_, operator0_.locale as locale40_1_, operator0_.operationMode as operatio5_40_1_, operator1_.id as id40_0_, operator1_.operatorName as operator2_40_0_, operator1_.parentId as parentId40_0_, operator1_.locale as locale40_0_, operator1_.operationMode as operatio5_40_0_ from core_operator_m3 operator0_ left outer join core_operator_m3 operator1_ on operator0_.parentId=operator1_.id where operator0_.id=?
DEBUG --- AbstractBatcher.getPreparedStatement(424) | preparing statement
DEBUG --- NullableType.nullSafeSet(80) | binding '1' to parameter: 1
DEBUG --- AbstractBatcher.logOpenResults(327) | about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG --- Loader.doQuery(682) | processing result set
DEBUG --- Loader.doQuery(687) | result set row: 0
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: id40_0_
DEBUG --- Loader.getRow(1164) | result row: null, EntityKey[org.helianto.core.Operator#1]
DEBUG --- Loader.loadFromResultSet(1347) | Initializing object from ResultSet: [org.helianto.core.Operator#1]
DEBUG --- AbstractEntityPersister.hydrate(1860) | Hydrating entity: [org.helianto.core.Operator#1]
DEBUG --- NullableType.nullSafeGet(122) | returning 'CAMFER' as column: operator2_40_1_
DEBUG --- NullableType.nullSafeGet(116) | returning null as column: parentId40_1_
DEBUG --- NullableType.nullSafeGet(122) | returning 'pt_BR' as column: locale40_1_
DEBUG --- NullableType.nullSafeGet(122) | returning 'L' as column: operatio5_40_1_
DEBUG --- Loader.doQuery(709) | done processing result set (1 rows)
DEBUG --- AbstractBatcher.logCloseResults(334) | about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG --- AbstractBatcher.logClosePreparedStatement(319) | about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG --- AbstractBatcher.closePreparedStatement(470) | closing statement
DEBUG --- Loader.initializeEntitiesAndCollections(839) | total objects hydrated: 1
DEBUG --- TwoPhaseLoad.initializeEntity(107) | resolving associations for [org.helianto.core.Operator#1]
DEBUG --- TwoPhaseLoad.initializeEntity(206) | done materializing entity [org.helianto.core.Operator#1]
DEBUG --- Loader.loadEntity(1808) | done entity load
DEBUG --- TwoPhaseLoad.initializeEntity(206) | done materializing entity [org.helianto.core.Entity#1]
DEBUG --- Loader.loadEntity(1808) | done entity load
DEBUG --- DefaultLoadEventListener.proxyOrLoad(153) | loading entity: [org.helianto.process.ExternalDocument#1]
DEBUG --- DefaultLoadEventListener.doLoad(304) | attempting to resolve: [org.helianto.process.ExternalDocument#1]
DEBUG --- DefaultLoadEventListener.doLoad(340) | object not resolved in any cache: [org.helianto.process.ExternalDocument#1]
DEBUG --- AbstractEntityPersister.load(2723) | Fetching entity: [org.helianto.process.ExternalDocument#1]
DEBUG --- Loader.loadEntity(1777) | loading entity: [org.helianto.process.ExternalDocument#1]
DEBUG --- AbstractBatcher.logOpenPreparedStatement(311) | about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG --- AbstractBatcher.log(346) | select externaldo0_.externalId as id6_0_, externaldo0_1_.entityId as entityId6_0_, externaldo0_1_.docCode as docCode6_0_, externaldo0_1_.docName as docName6_0_, externaldo0_.docUrl as docUrl36_0_, externaldo0_.docType as docType36_0_, externaldo0_.parentId as parentId36_0_ from process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id where externaldo0_.externalId=?
Hibernate: select externaldo0_.externalId as id6_0_, externaldo0_1_.entityId as entityId6_0_, externaldo0_1_.docCode as docCode6_0_, externaldo0_1_.docName as docName6_0_, externaldo0_.docUrl as docUrl36_0_, externaldo0_.docType as docType36_0_, externaldo0_.parentId as parentId36_0_ from process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id where externaldo0_.externalId=?
DEBUG --- AbstractBatcher.getPreparedStatement(424) | preparing statement
DEBUG --- NullableType.nullSafeSet(80) | binding '1' to parameter: 1
DEBUG --- AbstractBatcher.logOpenResults(327) | about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG --- Loader.doQuery(682) | processing result set
DEBUG --- Loader.doQuery(709) | done processing result set (0 rows)
DEBUG --- AbstractBatcher.logCloseResults(334) | about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG --- AbstractBatcher.logClosePreparedStatement(319) | about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG --- AbstractBatcher.closePreparedStatement(470) | closing statement
DEBUG --- Loader.initializeEntitiesAndCollections(839) | total objects hydrated: 0
DEBUG --- Loader.loadEntity(1808) | done entity load
INFO --- DefaultLoadEventListener.onLoad(95) | Error performing load command
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.helianto.process.ExternalDocument#1]
at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:128)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:161)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:830)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
at org.hibernate.type.EntityType.resolve(EntityType.java:303)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.helianto.core.hibernate.LightweightDaoImpl.find(LightweightDaoImpl.java:114)
at org.helianto.process.hibernate.ProcessDaoImpl.findExternalDocumentByParent(ProcessDaoImpl.java:53)
at org.helianto.process.service.ProcessMgrImpl.findExternalDocumentByParent(ProcessMgrImpl.java:152)
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:589)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:209)
at $Proxy5.findExternalDocumentByParent(Unknown Source)
at com.iservport.doc.view.DocumentTreeParser$DefaultRecurseStrategy.createNode(DocumentTreeParser.java:76)
at com.iservport.doc.view.DocumentTreeParser$DefaultRecurseStrategy.recurse(DocumentTreeParser.java:65)
at com.iservport.doc.view.DocumentTreeParser.parseTree(DocumentTreeParser.java:27)
at com.iservport.doc.view.DocumentTreeParser.parseTree(DocumentTreeParser.java:1)
at com.iservport.doc.controller.DocumentFormAction.parse(DocumentFormAction.java:27)
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:589)
at org.springframework.webflow.util.DispatchMethodInvoker.invoke(DispatchMethodInvoker.java:87)
Name and version of the database you are using:
Mysql 4.1.11
(but I am using a legacy database created with previous versions and transactions are not supported)
The generated SQL (show_sql=true):
That's the relevant one. If you look in the error log, you will see the same sql running without the exception.
Hibernate: select externaldo0_.externalId as id6_0_, externaldo0_1_.entityId as entityId6_0_, externaldo0_1_.docCode as docCode6_0_, externaldo0_1_.docName as docName6_0_, externaldo0_.docUrl as docUrl36_0_, externaldo0_.docType as docType36_0_, externaldo0_.parentId as parentId36_0_ from process_documentext_m3 externaldo0_ inner join process_document externaldo0_1_ on externaldo0_.externalId=externaldo0_1_.id where externaldo0_.externalId=?
Debug level Hibernate log excerpt:
DEBUG --- AbstractBatcher.getPreparedStatement(424) | preparing statement
DEBUG --- NullableType.nullSafeSet(80) | binding '1' to parameter: 1
DEBUG --- AbstractBatcher.logOpenResults(327) | about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG --- Loader.doQuery(682) | processing result set
DEBUG --- Loader.doQuery(709) | done processing result set (0 rows)
DEBUG --- AbstractBatcher.logCloseResults(334) | about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG --- AbstractBatcher.logClosePreparedStatement(319) | about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG --- AbstractBatcher.closePreparedStatement(470) | closing statement
DEBUG --- Loader.initializeEntitiesAndCollections(839) | total objects hydrated: 0
DEBUG --- Loader.loadEntity(1808) | done entity load
INFO --- DefaultLoadEventListener.onLoad(95) | Error performing load command
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.helianto.process.ExternalDocument#1]
As you can see here, the last result set comes empty. What I do not understand is: if I use a database tool to run the same sql with the parameter 1 (as the log above shows) directly into the database, it returns the expected row, i.e. the parent ExternalDocument required by the query.
I am looking for a solution now for two weeks, and can't figure out what is happening.
Thanks for any help.
|