Hi I can't seem to get the lazy column properties loaded properly, it works fine when I'm selecting a single object by calling Hibernate.initialize()... however if I get a list of objects I can't be issuing a single select per item to hydrate that column on each of them. My query is using "fetch all properties" like the docs say. And even the SQL seems to be selecting the column from the database, however it isn't hydrating the object.
Any help appreciated.
-David
Hibernate version:
3.0.5
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="org.tecas.model.StoredEmail" table="STORED_EMAIL">
<id name="id" column="ID" type="long" unsaved-value="null">
<generator class="native"/>
</id>
<many-to-one name="emailAddress" column="EMAIL_ADDRESS_ID" not-null="true"/>
<property name="email" column="EMAIL" lazy="true"/>
<property name="senderAddress" column="SENDER_ADDRESS"/>
<property name="size" column="SIZE"/>
<property name="storedDate" column="STORED_DATE" type="date"/>
<property name="subject" column="SUBJECT"/>
</class>
<query name="StoredEmail.By.EmailAddress"><![CDATA[ from org.tecas.model.StoredEmail email
where email.emailAddress = :EmailAddress order by email.id asc]]></query>
<query name="StoredEmail.By.ids"><![CDATA[ from org.tecas.model.StoredEmail email
fetch all properties left join fetch email.emailAddress where email.id in (:ids)]]></query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
public Set<StoredEmail> getStoredEmail(final Set<Long> ids) {
Collection results = (Collection) getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
return session.getNamedQuery("StoredEmail.By.ids")
.setParameterList("ids", ids)
.list();
}
});
return new HashSet<StoredEmail>(results);
}
the above method is called by below
Set<Long> ids = new HashSet<Long>();
ids.add(new Long(1));
ids.add(new Long(2));
Set<StoredEmail> emails = getEmailDao().getStoredEmail(ids);
TestCase.assertEquals("Size should be 2", 2, emails.size());
// ensure they are not lazily loaded
for (Iterator it = emails.iterator(); it.hasNext(); ) {
StoredEmail email = (StoredEmail) it.next();
String actualMessage = email.getEmail();
}
lazy exception thrown on email.getEmail();
Full stack trace of any exception that occurs:Code:
org.hibernate.LazyInitializationException: session is not connected
at org.hibernate.intercept.FieldInterceptor.intercept(FieldInterceptor.java:54)
at org.hibernate.intercept.FieldInterceptor.readObject(FieldInterceptor.java:113)
at org.tecas.model.StoredEmail.$cglib_read_email(StoredEmail.java)
at org.tecas.model.StoredEmail.getEmail(StoredEmail.java:39)
at org.tecas.dao.IEmailDaoTest.testGetStoredEmailByIds(IEmailDaoTest.java:60)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Name and version of the database you are using:HSQLDB
The generated SQL (show_sql=true):Code:
2005-07-06 13:46:21,390 [INFO ] org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.HSQLDialect
2005-07-06 13:46:21,390 [INFO ] org.hibernate.cfg.Configuration - processing extends queue
2005-07-06 13:46:21,390 [INFO ] org.hibernate.cfg.Configuration - processing collection mappings
2005-07-06 13:46:21,390 [INFO ] org.hibernate.cfg.Configuration - processing association property references
2005-07-06 13:46:21,390 [INFO ] org.hibernate.cfg.Configuration - processing foreign key constraints
2005-07-06 13:46:21,390 [DEBUG] org.hibernate.cfg.Configuration - resolving reference to class: org.tecas.model.User
2005-07-06 13:46:21,390 [DEBUG] org.hibernate.cfg.Configuration - resolving reference to class: org.tecas.model.EmailAddress
2005-07-06 13:46:21,390 [DEBUG] org.hibernate.cfg.Configuration - resolving reference to class: org.tecas.model.EmailAddress
2005-07-06 13:46:21,406 [DEBUG] org.hibernate.impl.SessionImpl - closing session
2005-07-06 13:46:21,406 [DEBUG] org.hibernate.jdbc.ConnectionManager - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2005-07-06 13:46:21,406 [DEBUG] org.hibernate.jdbc.JDBCContext - after transaction completion
2005-07-06 13:46:21,406 [DEBUG] org.hibernate.impl.SessionImpl - after transaction completion
2005-07-06 13:46:21,609 [DEBUG] org.hibernate.impl.SessionImpl - opened session at timestamp: 4590301927870464
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.impl.SessionImpl - find: from org.tecas.model.StoredEmail email
fetch all properties left join fetch email.emailAddress where email.id in (:ids0_, :ids1_)
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.engine.QueryParameters - named parameters: {ids0_=2, ids1_=1}
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.QueryTranslatorImpl - parse() - HQL: from org.tecas.model.StoredEmail email
fetch all properties left join fetch email.emailAddress where email.id in (:ids0_, :ids1_)
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.AST - --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| \-[FROM] 'from'
| +-[RANGE] 'RANGE'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[DOT] '.'
| | | | | +-[IDENT] 'org'
| | | | | \-[IDENT] 'tecas'
| | | | \-[IDENT] 'model'
| | | \-[IDENT] 'StoredEmail'
| | +-[ALIAS] 'email'
| | \-[FETCH] 'fetch'
| \-[JOIN] 'join'
| +-[LEFT] 'left'
| +-[FETCH] 'fetch'
| \-[DOT] '.'
| +-[IDENT] 'email'
| \-[IDENT] 'emailAddress'
\-[WHERE] 'where'
\-[IN] 'in'
+-[DOT] '.'
| +-[IDENT] 'email'
| \-[IDENT] 'id'
\-[IN_LIST] 'inList'
+-[COLON] ':'
| \-[IDENT] 'ids0_'
\-[COLON] ':'
\-[IDENT] 'ids1_'
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.antlr.HqlSqlBaseWalker - query() << begin, level = 1
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.FromElement - FromClause{level=1} : org.tecas.model.StoredEmail (email) -> storedemai0_
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.FromReferenceNode - Resolved : email -> storedemai0_.ID
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.DotNode - getDataType() : emailAddress -> org.hibernate.type.ManyToOneType(org.tecas.model.EmailAddress)
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.DotNode - dereferenceEntityJoin() : generating join for emailAddress in org.tecas.model.StoredEmail {no alias} parent = [ {null} ]
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.FromElement - FromClause{level=1} : org.tecas.model.EmailAddress (no alias) -> emailaddre1_
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.FromClause - addJoinByPathMap() : email.emailAddress -> EMAIL_ADDRESS emailaddre1_
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.FromReferenceNode - Resolved : email.emailAddress -> storedemai0_.EMAIL_ADDRESS_ID
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.HqlSqlWalker - createFromJoinElement() : -- join tree --
\-[JOIN_FRAGMENT] FromElement: 'EMAIL_ADDRESS emailaddre1_' FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=EMAIL_ADDRESS,tableAlias=emailaddre1_,colums={storedemai0_.EMAIL_ADDRESS_ID ,className=org.tecas.model.EmailAddress}}
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.FromReferenceNode - Resolved : email -> storedemai0_.ID
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.DotNode - getDataType() : id -> org.hibernate.type.LongType@15b0e2c
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.FromReferenceNode - Resolved : email.id -> storedemai0_.ID
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.antlr.HqlSqlBaseWalker - query() : finishing up , level = 1
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.HqlSqlWalker - processQuery() : ( SELECT ( FromClause{level=1} ( STORED_EMAIL storedemai0_ EMAIL_ADDRESS emailaddre1_ ) ) ( where ( in ( storedemai0_.ID storedemai0_.ID id ) ( inList ? ? ) ) ) )
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.HqlSqlWalker - Derived SELECT clause created.
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.JoinProcessor - Using FROM fragment [left outer join EMAIL_ADDRESS emailaddre1_ on storedemai0_.EMAIL_ADDRESS_ID=emailaddre1_.ID]
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.JoinProcessor - Using FROM fragment [STORED_EMAIL storedemai0_]
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.antlr.HqlSqlBaseWalker - query() >> end, level = 1
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.AST - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (STORED_EMAIL,EMAIL_ADDRESS)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'storedemai0_.ID as ID0_' {FromElement{explicit,not a collection join,not a fetch join,fetch all properties,classAlias=email,role=null,tableName=STORED_EMAIL,tableAlias=storedemai0_,colums={,className=org.tecas.model.StoredEmail}}}
| +-[SELECT_EXPR] SelectExpressionImpl: 'emailaddre1_.ID as ID1_' {FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=EMAIL_ADDRESS,tableAlias=emailaddre1_,colums={storedemai0_.EMAIL_ADDRESS_ID ,className=org.tecas.model.EmailAddress}}}
| +-[SQL_TOKEN] SqlFragment: 'storedemai0_.EMAIL_ADDRESS_ID as EMAIL2_2_0_, storedemai0_.EMAIL as EMAIL2_0_, storedemai0_.SENDER_ADDRESS as SENDER4_2_0_, storedemai0_.SIZE as SIZE2_0_, storedemai0_.STORED_DATE as STORED6_2_0_, storedemai0_.SUBJECT as SUBJECT2_0_'
| \-[SQL_TOKEN] SqlFragment: 'emailaddre1_.ADDRESS as ADDRESS0_1_, emailaddre1_.ADDED_DATE as ADDED3_0_1_, emailaddre1_.CONFIRMED as CONFIRMED0_1_, emailaddre1_.DELIMITER as DELIMITER0_1_, emailaddre1_.USER_ID as USER6_0_1_'
+-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=2, fromElements=2, fromElementByClassAlias=[email], fromElementByTableAlias=[emailaddre1_, storedemai0_], fromElementsByPath=[email.emailAddress], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'STORED_EMAIL storedemai0_' FromElement{explicit,not a collection join,not a fetch join,fetch all properties,classAlias=email,role=null,tableName=STORED_EMAIL,tableAlias=storedemai0_,colums={,className=org.tecas.model.StoredEmail}}
| \-[JOIN_FRAGMENT] FromElement: 'left outer join EMAIL_ADDRESS emailaddre1_ on storedemai0_.EMAIL_ADDRESS_ID=emailaddre1_.ID' FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=EMAIL_ADDRESS,tableAlias=emailaddre1_,colums={storedemai0_.EMAIL_ADDRESS_ID ,className=org.tecas.model.EmailAddress}}
\-[WHERE] SqlNode: 'where'
\-[IN] SqlNode: 'in'
+-[DOT] DotNode: 'storedemai0_.ID' {propertyName=id,dereferenceType=4,propertyPath=id,path=email.id,tableAlias=storedemai0_,className=org.tecas.model.StoredEmail,classAlias=email}
| +-[ALIAS_REF] IdentNode: 'storedemai0_.ID' {alias=email, className=org.tecas.model.StoredEmail, tableAlias=storedemai0_}
| \-[IDENT] IdentNode: 'id' {originalText=id}
\-[IN_LIST] SqlNode: 'inList'
+-[NAMED_PARAM] SqlNode: '?'
\-[NAMED_PARAM] SqlNode: '?'
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.QueryTranslatorImpl - HQL: from org.tecas.model.StoredEmail email
fetch all properties left join fetch email.emailAddress where email.id in (:ids0_, :ids1_)
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.QueryTranslatorImpl - SQL: select storedemai0_.ID as ID0_, emailaddre1_.ID as ID1_, storedemai0_.EMAIL_ADDRESS_ID as EMAIL2_2_0_, storedemai0_.EMAIL as EMAIL2_0_, storedemai0_.SENDER_ADDRESS as SENDER4_2_0_, storedemai0_.SIZE as SIZE2_0_, storedemai0_.STORED_DATE as STORED6_2_0_, storedemai0_.SUBJECT as SUBJECT2_0_, emailaddre1_.ADDRESS as ADDRESS0_1_, emailaddre1_.ADDED_DATE as ADDED3_0_1_, emailaddre1_.CONFIRMED as CONFIRMED0_1_, emailaddre1_.DELIMITER as DELIMITER0_1_, emailaddre1_.USER_ID as USER6_0_1_ from STORED_EMAIL storedemai0_ left outer join EMAIL_ADDRESS emailaddre1_ on storedemai0_.EMAIL_ADDRESS_ID=emailaddre1_.ID where storedemai0_.ID in (? , ?)
2005-07-06 13:46:21,625 [DEBUG] org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.jdbc.ConnectionManager - opening JDBC connection
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.SQL - select storedemai0_.ID as ID0_, emailaddre1_.ID as ID1_, storedemai0_.EMAIL_ADDRESS_ID as EMAIL2_2_0_, storedemai0_.EMAIL as EMAIL2_0_, storedemai0_.SENDER_ADDRESS as SENDER4_2_0_, storedemai0_.SIZE as SIZE2_0_, storedemai0_.STORED_DATE as STORED6_2_0_, storedemai0_.SUBJECT as SUBJECT2_0_, emailaddre1_.ADDRESS as ADDRESS0_1_, emailaddre1_.ADDED_DATE as ADDED3_0_1_, emailaddre1_.CONFIRMED as CONFIRMED0_1_, emailaddre1_.DELIMITER as DELIMITER0_1_, emailaddre1_.USER_ID as USER6_0_1_ from STORED_EMAIL storedemai0_ left outer join EMAIL_ADDRESS emailaddre1_ on storedemai0_.EMAIL_ADDRESS_ID=emailaddre1_.ID where storedemai0_.ID in (? , ?)
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.jdbc.AbstractBatcher - preparing statement
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.loader.hql.QueryLoader - bindNamedParameters() 2 -> ids0_ [1]
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.type.LongType - binding '2' to parameter: 1
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.loader.hql.QueryLoader - bindNamedParameters() 1 -> ids1_ [2]
2005-07-06 13:46:21,640 [DEBUG] org.hibernate.type.LongType - binding '1' to parameter: 2
2005-07-06 13:46:21,656 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-07-06 13:46:21,656 [DEBUG] org.hibernate.loader.Loader - processing result set
2005-07-06 13:46:21,656 [DEBUG] org.hibernate.loader.Loader - result set row: 0
2005-07-06 13:46:21,656 [DEBUG] org.hibernate.type.LongType - returning '1' as column: ID0_
2005-07-06 13:46:21,656 [DEBUG] org.hibernate.type.LongType - returning '1' as column: ID1_
2005-07-06 13:46:21,656 [DEBUG] org.hibernate.loader.Loader - result row: EntityKey[org.tecas.model.StoredEmail#1], EntityKey[org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,656 [DEBUG] org.hibernate.loader.Loader - Initializing object from ResultSet: [org.tecas.model.StoredEmail#1]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.persister.entity.BasicEntityPersister - Hydrating entity: [org.tecas.model.StoredEmail#1]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.LongType - returning '1' as column: EMAIL2_2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning 'TEST MESSAGE 1' as column: EMAIL2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning null as column: SENDER4_2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.IntegerType - returning null as column: SIZE2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.DateType - returning '01 January 2005' as column: STORED6_2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning null as column: SUBJECT2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.loader.Loader - Initializing object from ResultSet: [org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.persister.entity.BasicEntityPersister - Hydrating entity: [org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning 'test@ratemod.com' as column: ADDRESS0_1_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.TimestampType - returning null as column: ADDED3_0_1_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.BooleanType - returning null as column: CONFIRMED0_1_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning null as column: DELIMITER0_1_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.LongType - returning '1' as column: USER6_0_1_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.loader.Loader - result set row: 1
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.LongType - returning '2' as column: ID0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.LongType - returning '1' as column: ID1_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.loader.Loader - result row: EntityKey[org.tecas.model.StoredEmail#2], EntityKey[org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.loader.Loader - Initializing object from ResultSet: [org.tecas.model.StoredEmail#2]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.persister.entity.BasicEntityPersister - Hydrating entity: [org.tecas.model.StoredEmail#2]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.LongType - returning '1' as column: EMAIL2_2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning 'TEST MESSAGE 2' as column: EMAIL2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning null as column: SENDER4_2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.IntegerType - returning null as column: SIZE2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.DateType - returning '02 February 2005' as column: STORED6_2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.type.StringType - returning null as column: SUBJECT2_0_
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.loader.Loader - done processing result set (2 rows)
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.jdbc.AbstractBatcher - closing statement
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.loader.Loader - total objects hydrated: 3
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.engine.TwoPhaseLoad - resolving associations for [org.tecas.model.StoredEmail#1]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - loading entity: [org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,671 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - entity found in session cache
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.TwoPhaseLoad - done materializing entity [org.tecas.model.StoredEmail#1]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.TwoPhaseLoad - resolving associations for [org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.CollectionLoadContext - creating collection wrapper:[org.tecas.model.EmailAddress.emailCodes#1]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.CollectionLoadContext - creating collection wrapper:[org.tecas.model.EmailAddress.storedEmail#1]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - loading entity: [org.tecas.model.User#1]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - creating new proxy for entity
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.TwoPhaseLoad - done materializing entity [org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.TwoPhaseLoad - resolving associations for [org.tecas.model.StoredEmail#2]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - loading entity: [org.tecas.model.EmailAddress#1]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - entity found in session cache
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.TwoPhaseLoad - done materializing entity [org.tecas.model.StoredEmail#2]
2005-07-06 13:46:21,687 [DEBUG] org.hibernate.engine.PersistenceContext - initializing non-lazy collections
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultInitializeCollectionEventListener - initializing collection [org.tecas.model.EmailAddress.emailCodes#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultInitializeCollectionEventListener - checking second-level cache
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultInitializeCollectionEventListener - collection not cached
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - loading collection: [org.tecas.model.EmailAddress.emailCodes#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.SQL - select emailcodes0_.EMAIL_ADDRESS_ID as EMAIL4_1_, emailcodes0_.ID as ID1_, emailcodes0_.POS as POS1_, emailcodes0_.ID as ID0_, emailcodes0_.CODE as CODE1_0_, emailcodes0_.NAME as NAME1_0_ from EMAIL_CODE emailcodes0_ where emailcodes0_.EMAIL_ADDRESS_ID=?
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.jdbc.AbstractBatcher - preparing statement
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.LongType - binding '1' to parameter: 1
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - result set contains (possibly empty) collection: [org.tecas.model.EmailAddress.emailCodes#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.CollectionLoadContext - uninitialized collection: initializing
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - processing result set
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - result set row: 0
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.LongType - returning '1' as column: ID0_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - result row: EntityKey[org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - Initializing object from ResultSet: [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.persister.entity.BasicEntityPersister - Hydrating entity: [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.StringType - returning 'ASDF' as column: CODE1_0_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.StringType - returning '' as column: NAME1_0_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.LongType - returning '1' as column: EMAIL4_1_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - found row of collection: [org.tecas.model.EmailAddress.emailCodes#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.CollectionLoadContext - reading row
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.LongType - returning '1' as column: ID1_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - loading entity: [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - attempting to resolve: [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - resolved object in session cache: [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.IntegerType - returning '0' as column: POS1_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - result set row: 1
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.LongType - returning '2' as column: ID0_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - result row: EntityKey[org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - Initializing object from ResultSet: [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.persister.entity.BasicEntityPersister - Hydrating entity: [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.StringType - returning 'QWERTY' as column: CODE1_0_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.StringType - returning '' as column: NAME1_0_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.LongType - returning '1' as column: EMAIL4_1_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - found row of collection: [org.tecas.model.EmailAddress.emailCodes#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.CollectionLoadContext - reading row
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.LongType - returning '2' as column: ID1_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - loading entity: [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - attempting to resolve: [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultLoadEventListener - resolved object in session cache: [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.type.IntegerType - returning '1' as column: POS1_
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - done processing result set (2 rows)
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.jdbc.AbstractBatcher - closing statement
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - total objects hydrated: 2
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.TwoPhaseLoad - resolving associations for [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.TwoPhaseLoad - done materializing entity [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.TwoPhaseLoad - resolving associations for [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.TwoPhaseLoad - done materializing entity [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.CollectionLoadContext - 1 collections were found in result set for role: org.tecas.model.EmailAddress.emailCodes
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.CollectionLoadContext - collection fully initialized: [org.tecas.model.EmailAddress.emailCodes#1]
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.CollectionLoadContext - 1 collections initialized for role: org.tecas.model.EmailAddress.emailCodes
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.loader.Loader - done loading collection
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.DefaultInitializeCollectionEventListener - collection initialized
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.jdbc.JDBCContext - after autocommit
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.impl.SessionImpl - after transaction completion
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - flushing session
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: org.tecas.model.EmailAddress
2005-07-06 13:46:21,703 [DEBUG] org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: org.tecas.model.EmailAddress.emailCodes
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - cascading to saveOrUpdate: org.tecas.model.EmailCode
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: org.tecas.model.EmailCode
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [org.tecas.model.EmailCode#1]
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - cascading to saveOrUpdate: org.tecas.model.EmailCode
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: org.tecas.model.EmailCode
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [org.tecas.model.EmailCode#2]
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: org.tecas.model.EmailAddress.emailCodes
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - deleting orphans for collection: org.tecas.model.EmailAddress.emailCodes
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - done deleting orphans for collection: org.tecas.model.EmailAddress.emailCodes
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: org.tecas.model.EmailAddress.storedEmail
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: org.tecas.model.EmailAddress.storedEmail
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - deleting orphans for collection: org.tecas.model.EmailAddress.storedEmail
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - done deleting orphans for collection: org.tecas.model.EmailAddress.storedEmail
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: org.tecas.model.EmailAddress
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
2005-07-06 13:46:21,718 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.engine.Collections - Collection found: [org.tecas.model.EmailAddress.emailCodes#1], was: [org.tecas.model.EmailAddress.emailCodes#1] (initialized)
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.engine.Collections - Collection found: [org.tecas.model.EmailAddress.storedEmail#1], was: [org.tecas.model.EmailAddress.storedEmail#1] (uninitialized)
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 5 objects
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 2 collections
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.pretty.Printer - listing entities:
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.pretty.Printer - org.tecas.model.EmailCode{code=ASDF, name=, id=1}
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.pretty.Printer - org.tecas.model.EmailAddress{delimiter=null, user=org.tecas.model.User#1, confirmed=null, address=test@ratemod.com, emailCodes=[org.tecas.model.EmailCode#1, org.tecas.model.EmailCode#2], storedEmail=<uninitialized>, addedDate=null, id=1}
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.pretty.Printer - org.tecas.model.EmailCode{code=QWERTY, name=, id=2}
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.pretty.Printer - org.tecas.model.StoredEmail{senderAddress=null, emailAddress=org.tecas.model.EmailAddress#1, storedDate=02 February 2005, email=<lazy>, subject=null, size=null, id=2}
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.pretty.Printer - org.tecas.model.StoredEmail{senderAddress=null, emailAddress=org.tecas.model.EmailAddress#1, storedDate=01 January 2005, email=<lazy>, subject=null, size=null, id=1}
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - executing flush
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.event.def.AbstractFlushingEventListener - post flush
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.impl.SessionImpl - closing session
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.jdbc.ConnectionManager - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.jdbc.JDBCContext - after transaction completion
2005-07-06 13:46:21,734 [DEBUG] org.hibernate.impl.SessionImpl - after transaction completion
2005-07-06 13:46:21,875 [DEBUG] org.hibernate.jdbc.ConnectionManager - running Session.finalize()
2005-07-06 13:46:21,875 [ERROR] org.hibernate.LazyInitializationException - session is not connected
org.hibernate.LazyInitializationException: session is not connected
at org.hibernate.intercept.FieldInterceptor.intercept(FieldInterceptor.java:54)
at org.hibernate.intercept.FieldInterceptor.readObject(FieldInterceptor.java:113)
at org.tecas.model.StoredEmail.$cglib_read_email(StoredEmail.java)
at org.tecas.model.StoredEmail.getEmail(StoredEmail.java:39)
at org.tecas.dao.IEmailDaoTest.testGetStoredEmailByIds(IEmailDaoTest.java:60)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)