<set name="usertofunc" table="USERTOFUNC" lazy="true">
<key column="EMPSEQNO"/>
<composite-element class="Usertofunc">
<many-to-one name="sysmenu" class="com.capinfo.ems.login.dao.hibernate.Sysmenu" column="FUNCID" outer-join="auto"/>
<property column="SDATE" length="7" name="sdate" type="java.util.Date"/>
<property column="EDATE" length="7" name="edate" type="java.util.Date"/>
</composite-element>
</set>
when i use this set in mapping .
it goes well.
but it can not initialize the class Usertofunc.
follow is exception.
ysuser0_.EMPSEQNO as x0_0_ from CAPBUSS.SYSUSER sysuser0_ where (sysuser0_.EMPID=? )
14:02:58,750 DEBUG BatcherImpl:241 - preparing statement
14:02:59,040 DEBUG IteratorImpl:69 - retrieving next results
14:02:59,180 DEBUG SessionImpl:1950 - loading [com.capinfo.ems.login.dao.hibernate.Sysuser#1]
14:02:59,180 DEBUG SessionImpl:2047 - attempting to resolve [com.capinfo.ems.login.dao.hibernate.Sysuser#1]
14:02:59,200 DEBUG SessionImpl:2080 - object not resolved in any cache [com.capinfo.ems.login.dao.hibernate.Sysuser#1]
14:02:59,200 DEBUG EntityPersister:416 - Materializing entity: [com.capinfo.ems.login.dao.hibernate.Sysuser#1]
14:02:59,210 DEBUG BatcherImpl:196 - about to open: 1 open PreparedStatements, 1 open ResultSets
14:02:59,210 DEBUG SQL:237 - select sysuser0_.EMPSEQNO as EMPSEQNO0_, sysuser0_.EMPID as EMPID0_, sysuser0_.EMPNAME as EMPNAME0_, sysuser0_.PWD as PWD0_, sysuser0_.AVLSDATE as AVLSDATE0_, sysuser0_.AVLEDATE as AVLEDATE0_, sysuser0_.MEMO as MEMO0_, sysuser0_.USERSTATE as USERSTATE0_, sysuser0_.PUBICKEY as PUBICKEY0_, sysuser0_.VALIDTAG as VALIDTAG0_, sysuser0_.LOSSDATE as LOSSDATE0_ from CAPBUSS.SYSUSER sysuser0_ where sysuser0_.EMPSEQNO=?
Hibernate: select sysuser0_.EMPSEQNO as EMPSEQNO0_, sysuser0_.EMPID as EMPID0_, sysuser0_.EMPNAME as EMPNAME0_, sysuser0_.PWD as PWD0_, sysuser0_.AVLSDATE as AVLSDATE0_, sysuser0_.AVLEDATE as AVLEDATE0_, sysuser0_.MEMO as MEMO0_, sysuser0_.USERSTATE as USERSTATE0_, sysuser0_.PUBICKEY as PUBICKEY0_, sysuser0_.VALIDTAG as VALIDTAG0_, sysuser0_.LOSSDATE as LOSSDATE0_ from CAPBUSS.SYSUSER sysuser0_ where sysuser0_.EMPSEQNO=?
14:02:59,220 DEBUG BatcherImpl:241 - preparing statement
14:02:59,230 DEBUG Loader:197 - processing result set
14:02:59,240 DEBUG Loader:405 - result row: 1
14:02:59,270 DEBUG Loader:536 - Initializing object from ResultSet: 1
14:02:59,280 DEBUG Loader:605 - Hydrating entity: com.capinfo.ems.login.dao.hibernate.Sysuser#1
14:02:59,290 DEBUG Loader:226 - done processing result set (1 rows)
14:02:59,350 DEBUG BatcherImpl:203 - done closing: 1 open PreparedStatements, 1 open ResultSets
14:02:59,350 DEBUG BatcherImpl:261 - closing statement
14:02:59,380 DEBUG Loader:239 - total objects hydrated: 1
14:02:59,380 DEBUG SessionImpl:2166 - resolving associations for [com.capinfo.ems.login.dao.hibernate.Sysuser#1]
14:02:59,390 DEBUG SessionImpl:3891 - creating collection wrapper:[com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
14:02:59,390 DEBUG SessionImpl:2190 - done materializing entity [com.capinfo.ems.login.dao.hibernate.Sysuser#1]
14:02:59,400 DEBUG SessionImpl:3082 - initializing non-lazy collections
14:02:59,410 DEBUG IteratorImpl:65 - exhausted results
14:02:59,451 DEBUG IteratorImpl:53 - closing iterator
14:02:59,451 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
14:02:59,451 DEBUG BatcherImpl:261 - closing statement
14:02:59,461 DEBUG IteratorImpl:92 - returning current results
14:02:59,461 DEBUG JDBCTransaction:59 - commit
14:02:59,471 DEBUG SessionImpl:2210 - flushing session
14:02:59,481 DEBUG SessionImpl:2403 - Flushing entities and processing referenced collections
14:02:59,501 DEBUG SessionImpl:2850 - Collection found: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1], was: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
14:02:59,501 DEBUG SessionImpl:2746 - Processing unreferenced collections
14:02:59,501 DEBUG SessionImpl:2760 - Scheduling collection removes/(re)creates/updates
14:02:59,501 DEBUG SessionImpl:2234 - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
14:02:59,511 DEBUG SessionImpl:2239 - Flushed: 0 (re)creations, 0 updates, 0 removals to 1 collections
14:02:59,511 DEBUG Printer:75 - listing entities:
14:02:59,711 DEBUG Printer:82 - com.capinfo.ems.login.dao.hibernate.Sysuser{usertofunc=uninitialized, pubickey=0, memo=null, validtag=null, userstate=0, lossdate=null, empname=test, avlsdate=01 四月 2004 00:00:00, empid=1, empseqno=1, avledate=null, pwd=1}
14:02:59,711 DEBUG SessionImpl:2323 - executing flush
14:02:59,711 DEBUG SessionImpl:2790 - post flush
14:02:59,731 DEBUG SessionImpl:561 - transaction completion
14:02:59,741 DEBUG SessionImpl:2210 - flushing session
14:02:59,741 DEBUG SessionImpl:2403 - Flushing entities and processing referenced collections
14:02:59,741 DEBUG SessionImpl:2850 - Collection found: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1], was: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
14:02:59,741 DEBUG SessionImpl:2746 - Processing unreferenced collections
14:02:59,741 DEBUG SessionImpl:2760 - Scheduling collection removes/(re)creates/updates
14:02:59,761 DEBUG SessionImpl:2234 - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
14:02:59,761 DEBUG SessionImpl:2239 - Flushed: 0 (re)creations, 0 updates, 0 removals to 1 collections
14:02:59,761 DEBUG Printer:75 - listing entities:
14:02:59,761 DEBUG Printer:82 - com.capinfo.ems.login.dao.hibernate.Sysuser{usertofunc=uninitialized, pubickey=0, memo=null, validtag=null, userstate=0, lossdate=null, empname=test, avlsdate=01 四月 2004 00:00:00, empid=1, empseqno=1, avledate=null, pwd=1}
14:02:59,761 DEBUG SessionImpl:2323 - executing flush
14:02:59,761 DEBUG SessionImpl:2790 - post flush
1
14:02:59,771 DEBUG SessionImpl:3218 - initializing collection [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
14:02:59,771 DEBUG SessionImpl:3219 - checking second-level cache
14:02:59,771 DEBUG SessionImpl:3225 - collection not cached
14:02:59,771 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
14:02:59,771 DEBUG SQL:237 - select usertofunc0_.FUNCID as FUNCID__, usertofunc0_.SDATE as SDATE__, usertofunc0_.EDATE as EDATE__, usertofunc0_.EMPSEQNO as EMPSEQNO__, sysmenu1_.FUNCID as FUNCID0_, sysmenu1_.FUNCNAME as FUNCNAME0_, sysmenu1_.MEMO as MEMO0_ from CAPBUSS.USERTOFUNC usertofunc0_, CAPBUSS.SYSMENU sysmenu1_ where usertofunc0_.EMPSEQNO=? and usertofunc0_.FUNCID=sysmenu1_.FUNCID(+)
Hibernate: select usertofunc0_.FUNCID as FUNCID__, usertofunc0_.SDATE as SDATE__, usertofunc0_.EDATE as EDATE__, usertofunc0_.EMPSEQNO as EMPSEQNO__, sysmenu1_.FUNCID as FUNCID0_, sysmenu1_.FUNCNAME as FUNCNAME0_, sysmenu1_.MEMO as MEMO0_ from CAPBUSS.USERTOFUNC usertofunc0_, CAPBUSS.SYSMENU sysmenu1_ where usertofunc0_.EMPSEQNO=? and usertofunc0_.FUNCID=sysmenu1_.FUNCID(+)
14:02:59,791 DEBUG BatcherImpl:241 - preparing statement
14:02:59,801 DEBUG Loader:327 - result set contains (possibly empty) collection: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
14:02:59,801 DEBUG SessionImpl:2984 - uninitialized collection: initializing
14:02:59,801 DEBUG Loader:197 - processing result set
14:02:59,811 DEBUG JDBCExceptionReporter:36 - SQL Exception
java.sql.SQLException: 无法转换为内部表示
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:910)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:885)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:69)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3226)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:200)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.toString(Set.java:218)
at java.lang.String.valueOf(String.java:2131)
at java.io.PrintStream.print(PrintStream.java:462)
at java.io.PrintStream.println(PrintStream.java:599)
at com.capinfo.ems.login.dao.hibernate.TestSysuser.main(TestSysuser.java:17)
14:03:00,001 WARN JDBCExceptionReporter:38 - SQL Error: 17059, SQLState: null
14:03:00,021 ERROR JDBCExceptionReporter:46 - 无法转换为内部表示
14:03:00,021 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
14:03:00,021 DEBUG BatcherImpl:261 - closing statement
14:03:00,061 DEBUG JDBCExceptionReporter:36 - SQL Exception
java.sql.SQLException: 无法转换为内部表示
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:910)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:885)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:69)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3226)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:200)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.toString(Set.java:218)
at java.lang.String.valueOf(String.java:2131)
at java.io.PrintStream.print(PrintStream.java:462)
at java.io.PrintStream.println(PrintStream.java:599)
at com.capinfo.ems.login.dao.hibernate.TestSysuser.main(TestSysuser.java:17)
14:03:00,101 WARN JDBCExceptionReporter:38 - SQL Error: 17059, SQLState: null
14:03:00,101 ERROR JDBCExceptionReporter:46 - 无法转换为内部表示
14:03:00,101 ERROR JDBCExceptionReporter:38 - could not initialize collection: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
java.sql.SQLException: 无法转换为内部表示
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:910)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:885)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:69)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3226)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:200)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.toString(Set.java:218)
at java.lang.String.valueOf(String.java:2131)
at java.io.PrintStream.print(PrintStream.java:462)
at java.io.PrintStream.println(PrintStream.java:599)
at com.capinfo.ems.login.dao.hibernate.TestSysuser.main(TestSysuser.java:17)
14:03:00,132 ERROR PersistentCollection:203 - Failed to lazily initialize a collection
net.sf.hibernate.JDBCException: could not initialize collection: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:287)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3226)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:200)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.toString(Set.java:218)
at java.lang.String.valueOf(String.java:2131)
at java.io.PrintStream.print(PrintStream.java:462)
at java.io.PrintStream.println(PrintStream.java:599)
at com.capinfo.ems.login.dao.hibernate.TestSysuser.main(TestSysuser.java:17)
Caused by: java.sql.SQLException: 无法转换为内部表示
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:910)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:885)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:69)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
... 8 more
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:206)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.toString(Set.java:218)
at java.lang.String.valueOf(String.java:2131)
at java.io.PrintStream.print(PrintStream.java:462)
at java.io.PrintStream.println(PrintStream.java:599)
at com.capinfo.ems.login.dao.hibernate.TestSysuser.main(TestSysuser.java:17)
Caused by: net.sf.hibernate.JDBCException: could not initialize collection: [com.capinfo.ems.login.dao.hibernate.Sysuser.usertofunc#1]
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:287)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3226)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:200)
... 6 more
Caused by: java.sql.SQLException: 无法转换为内部表示
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:1540)
at net.sf.hibernate.type.LongType.get(LongType.java:18)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:352)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:203)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:910)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:885)
at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:69)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
|