Hibernate version: 3.0
Code between sessionFactory.openSession() and session.close():
Module module = sub.getModule(); ......... ......... .........
List modules = hSession.createQuery("from Module module order by module.moduleid").list();
Name and version of the database you are using: MS SQL 2000
The generated SQL (show_sql=true): select module0_.moduleid as moduleid, module0_.dir as dir1_, module0_.name as name1_, module0_.userControlled as userCont4_1_ from te_module module0_ order by module0_.moduleid
Debug level Hibernate log excerpt: org.hibernate.jdbc.AbstractBatcher -- preparing statement org.hibernate.jdbc.AbstractBatcher -- about to open ResultSet (open ResultSets: 0, globally: 0) org.hibernate.loader.Loader -- processing result set org.hibernate.loader.Loader -- result set row: 0 org.hibernate.type.IntegerType -- returning '1' as column: moduleid org.hibernate.loader.Loader -- result row: EntityKey[com.hibernate.model.Module#1] org.hibernate.loader.Loader -- Initializing object from ResultSet: [com.hibernate.model.Module#1] org.hibernate.persister.entity.BasicEntityPersister -- Hydrating entity: [com.hibernate.model.Module#1] org.hibernate.type.StringType -- returning ' ' as column: dir1_ org.hibernate.type.StringType -- returning 'Main ' as column: name1_ org.hibernate.type.ByteType -- returning '0' as column: userCont4_1_ org.hibernate.loader.Loader -- result set row: 1 org.hibernate.type.IntegerType -- returning '2' as column: moduleid org.hibernate.loader.Loader -- result row: EntityKey[com.hibernate.model.Module#2] org.hibernate.loader.Loader -- result set row: 2 org.hibernate.type.IntegerType -- returning '3' as column: moduleid org.hibernate.loader.Loader -- result row: EntityKey[com.hibernate.model.Module#3] org.hibernate.loader.Loader -- Initializing object from ResultSet: [com.hibernate.model.Module#3] org.hibernate.persister.entity.BasicEntityPersister -- Hydrating entity: [com.hibernate.model.Module#3] org.hibernate.type.StringType -- returning 'newsletter' as column: dir1_ org.hibernate.type.StringType -- returning 'Newsletter ' as column: name1_ org.hibernate.type.ByteType -- returning '1' as column: userCont4_1_ org.hibernate.loader.Loader -- result set row: 3 org.hibernate.type.IntegerType -- returning '4' as column: moduleid org.hibernate.loader.Loader -- result row: EntityKey[com.hibernate.model.Module#4] org.hibernate.loader.Loader -- Initializing object from ResultSet: [com.hibernate.model.Module#4] org.hibernate.persister.entity.BasicEntityPersister -- Hydrating entity: [com.hibernate.model.Module#4] org.hibernate.type.StringType -- returning ' ' as column: dir1_ org.hibernate.type.StringType -- returning 'Link to external Page ' as column: name1_ org.hibernate.type.ByteType -- returning '1' as column: userCont4_1_ org.hibernate.loader.Loader -- result set row: 4 org.hibernate.type.IntegerType -- returning '5' as column: moduleid org.hibernate.loader.Loader -- result row: EntityKey[com.hibernate.model.Module#5] org.hibernate.loader.Loader -- Initializing object from ResultSet: [com.hibernate.model.Module#5] org.hibernate.persister.entity.BasicEntityPersister -- Hydrating entity: [com.hibernate.model.Module#5] org.hibernate.type.StringType -- returning 'sub ' as column: dir1_ org.hibernate.type.StringType -- returning 'Financial Calculators ' as column: name1_ org.hibernate.type.ByteType -- returning '1' as column: userCont4_1_ org.hibernate.loader.Loader -- result set row: 5 org.hibernate.type.IntegerType -- returning '6' as column: moduleid org.hibernate.loader.Loader -- result row: EntityKey[com.hibernate.model.Module#6] org.hibernate.loader.Loader -- Initializing object from ResultSet: [com.hibernate.model.Module#6] org.hibernate.persister.entity.BasicEntityPersister -- Hydrating entity: [com.hibernate.model.Module#6] org.hibernate.type.StringType -- returning 'sub ' as column: dir1_ org.hibernate.type.StringType -- returning 'Form submission ' as column: name1_ org.hibernate.type.ByteType -- returning '1' as column: userCont4_1_ org.hibernate.loader.Loader -- result set row: 6 org.hibernate.type.IntegerType -- returning '7' as column: moduleid org.hibernate.loader.Loader -- result row: EntityKey[com.hibernate.model.Module#7] org.hibernate.loader.Loader -- Initializing object from ResultSet: [com.hibernate.model.Module#7] org.hibernate.persister.entity.BasicEntityPersister -- Hydrating entity: [com.hibernate.model.Module#7] org.hibernate.type.StringType -- returning 'sub ' as column: dir1_ org.hibernate.type.StringType -- returning 'Site Map ' as column: name1_ org.hibernate.type.ByteType -- returning '1' as column: userCont4_1_ org.hibernate.loader.Loader -- done processing result set (7 rows) org.hibernate.jdbc.AbstractBatcher -- about to close ResultSet (open ResultSets: 1, globally: 1) org.hibernate.jdbc.AbstractBatcher -- about to close PreparedStatement (open PreparedStatements: 1, globally: 1) org.hibernate.jdbc.AbstractBatcher -- closing statement org.hibernate.loader.Loader -- total objects hydrated: 6 org.hibernate.engine.TwoPhaseLoad -- resolving associations for [com.hibernate.model.Module#1] org.hibernate.engine.CollectionLoadContext -- creating collection wrapper:[com.hibernate.model.Module.layouts#1] org.hibernate.engine.TwoPhaseLoad -- done materializing entity [com.hibernate.model.Module#1] org.hibernate.engine.TwoPhaseLoad -- resolving associations for [com.hibernate.model.Module#3] org.hibernate.engine.CollectionLoadContext -- creating collection wrapper:[com.hibernate.model.Module.layouts#3] org.hibernate.engine.TwoPhaseLoad -- done materializing entity [com.hibernate.model.Module#3] org.hibernate.engine.TwoPhaseLoad -- resolving associations for [com.hibernate.model.Module#4] org.hibernate.engine.CollectionLoadContext -- creating collection wrapper:[com.hibernate.model.Module.layouts#4] org.hibernate.engine.TwoPhaseLoad -- done materializing entity [com.hibernate.model.Module#4] org.hibernate.engine.TwoPhaseLoad -- resolving associations for [com.hibernate.model.Module#5] org.hibernate.engine.CollectionLoadContext -- creating collection wrapper:[com.hibernate.model.Module.layouts#5] org.hibernate.engine.TwoPhaseLoad -- done materializing entity [com.hibernate.model.Module#5] org.hibernate.engine.TwoPhaseLoad -- resolving associations for [com.hibernate.model.Module#6] org.hibernate.engine.CollectionLoadContext -- creating collection wrapper:[com.hibernate.model.Module.layouts#6] org.hibernate.engine.TwoPhaseLoad -- done materializing entity [com.hibernate.model.Module#6] org.hibernate.engine.TwoPhaseLoad -- resolving associations for [com.hibernate.model.Module#7] org.hibernate.engine.CollectionLoadContext -- creating collection wrapper:[com.hibernate.model.Module.layouts#7] org.hibernate.engine.TwoPhaseLoad -- done materializing entity [com.hibernate.model.Module#7] org.hibernate.engine.PersistenceContext -- initializing non-lazy collections
in my code I get object Module from its parent sub, than further down before commiting transaction I need to get a list of all objects Module from the database, when list is returned to me (sql attached) the object that was retrieved earlier from its parent has all values set to null but its id (which is pripary key). What am I doing wong? How can I have this module too retrieved within the list? I only need to read its values, not to edit.
|