-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: objects conflict
PostPosted: Tue Aug 09, 2005 8:58 pm 
Newbie

Joined: Fri May 27, 2005 3:19 pm
Posts: 18
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 09, 2005 9:18 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
Try...

List modules = hSession.createQuery("select module from Module module order by module.moduleid").list();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 1:38 pm 
Newbie

Joined: Fri May 27, 2005 3:19 pm
Posts: 18
Nope, that gives me the same thing. Any other ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 1:40 pm 
Newbie

Joined: Fri May 27, 2005 3:19 pm
Posts: 18
Also when I look at the values in the debugger, All Module object in the list are reported as usual, however, this one module says Module$$EnhancerByCGLIB$$...

What does that mean?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 4:47 pm 
Senior
Senior

Joined: Wed Jul 13, 2005 4:31 pm
Posts: 142
Location: Seattle, WA
Can you post your mapping file


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 4:56 pm 
Newbie

Joined: Fri May 27, 2005 3:19 pm
Posts: 18
<hibernate-mapping package="com.hibernate.model">
<class name="com.tmplengine.hibernate.model.Module" table="te_module" lazy="true">
<id name="moduleid" type="java.lang.Integer" unsaved-value="null">
<column name="moduleid" not-null="true" />
<generator class="increment" />
</id>
<property name="dir">
<column name="dir" sql-type="string" />
</property>
<property name="name">
<column name="name" sql-type="string" />
</property>
<property name="userControlled">
<column name="userControlled" sql-type="byte"/>
</property>
<bag name="layouts" cascade="all-delete-orphan" inverse="true" lazy="true" order-by="orderid">
<key>
<column name="moduleid" />
</key>
<one-to-many class="TeContentlayout" />
</bag>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 6:43 pm 
Newbie

Joined: Fri May 27, 2005 3:19 pm
Posts: 18
Ok, my fault, problem was somewhere else. What got me confused that Eclipse debugger was showing null for all the values in proxied object even though I application was able to pull proper values. Just wondering, do you happened to have the same behavior with your IDE ?
Thank you for your time


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.