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.  [ 1 post ] 
Author Message
 Post subject: problem in reading object after saving
PostPosted: Tue Oct 03, 2006 11:05 am 
Newbie

Joined: Tue Oct 03, 2006 9:35 am
Posts: 1
Location: india
Hibernate version: 3

Mapping documents:
EcpSession.hbm.xml
hibernate-mapping>
<class name="com.celiberate.ecp.EcpSession" table="ECP_SESSION" catalog="celiberate">
<id name="sessionToken" type="java.lang.String">
<column name="SESSION_TOKEN" />
<generator class="assigned" />
</id>
<property name="iname" type="java.lang.String">
<column name="INAME" not-null="true" />
</property>
<property name="clientId" type="java.lang.Integer">
<column name="CLIENT_ID" not-null="true" />
</property>
<property name="loginTime" type="java.util.Date">
<column name="LOGIN_TIME" length="19" not-null="true" />
</property>
<property name="lastAccessedTime" type="java.util.Date">
<column name="LAST_ACCESSED_TIME" length="19" not-null="true" />
</property>
</class>
</hibernate-mapping>

auto commit is false in hibernate.cfg.xml

Code between sessionFactory.openSession() and session.close():

we are storing session in ThreadLocal
here is the code flow:

//get the session from ThreadLocal
Session session ....
Transaction tx=session.beginTransaction();
//save the EcpSession object
session.saveOrUpdate(transientInstance);
tx.commit();

//get the object out of session, where id is the SESSION_TOKEN
// of the recently added EcpSession object
//this statement is returning a null
EcpSession ecpSession=session.get("com.celiberate.ecp.EcpSession", id);




Name and version of the database you are using:
MySQL 5.0.17-nt

The generated SQL (show_sql=true):
Hibernate: select ecpsession_.SESSION_TOKEN, ecpsession_.INAME as INAME6_, ecpsession_.CLIENT_ID as CLIENT3_6_, ecpsession_.LOGIN_TIME as LOGIN4_6_, ecpsession_.LAST_ACCESSED_TIME as LAST5_6_ from celiberate.ECP_SESSION ecpsession_ where ecpsession_.SESSION_TOKEN=?
Hibernate: insert into celiberate.ECP_SESSION (INAME, CLIENT_ID, LOGIN_TIME, LAST_ACCESSED_TIME, SESSION_TOKEN) values (?, ?, ?, ?, ?)
Hibernate: select ecpsession0_.SESSION_TOKEN as SESSION1_6_0_, ecpsession0_.INAME as INAME6_0_, ecpsession0_.CLIENT_ID as CLIENT3_6_0_, ecpsession0_.LOGIN_TIME as LOGIN4_6_0_, ecpsession0_.LAST_ACCESSED_TIME as LAST5_6_0_ from celiberate.ECP_SESSION ecpsession0_ where ecpsession0_.SESSION_TOKEN=?

Debug level Hibernate log excerpt:
DEBUG org.hibernate.event.def.DefaultLoadEventListener -loading entity: [com.celiberate.ecp.EcpSession#d6e4a134-324c-4366-aa1c-52e934c2da4c]
DEBUG org.hibernate.event.def.DefaultLoadEventListener -attempting to resolve: [com.celiberate.ecp.EcpSession#d6e4a134-324c-4366-aa1c-52e934c2da4c]
DEBUG org.hibernate.event.def.DefaultLoadEventListener -object not resolved in any cache: [com.celiberate.ecp.EcpSession#d6e4a134-324c-4366-aa1c-52e934c2da4c]
DEBUG org.hibernate.persister.entity.AbstractEntityPersister -Fetching entity: [com.celiberate.ecp.EcpSession#d6e4a134-324c-4366-aa1c-52e934c2da4c]
DEBUG org.hibernate.loader.Loader -loading entity: [com.celiberate.ecp.EcpSession#d6e4a134-324c-4366-aa1c-52e934c2da4c]
DEBUG org.hibernate.jdbc.AbstractBatcher -about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG org.hibernate.SQL -select ecpsession0_.SESSION_TOKEN as SESSION1_6_0_, ecpsession0_.INAME as INAME6_0_, ecpsession0_.CLIENT_ID as CLIENT3_6_0_, ecpsession0_.LOGIN_TIME as LOGIN4_6_0_, ecpsession0_.LAST_ACCESSED_TIME as LAST5_6_0_ from celiberate.ECP_SESSION ecpsession0_ where ecpsession0_.SESSION_TOKEN=?
DEBUG org.hibernate.jdbc.AbstractBatcher -preparing statement
DEBUG org.hibernate.type.StringType -binding 'd6e4a134-324c-4366-aa1c-52e934c2da4c' to parameter: 1
DEBUG org.hibernate.jdbc.AbstractBatcher -about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG org.hibernate.loader.Loader -processing result set
DEBUG org.hibernate.loader.Loader -done processing result set (0 rows)
DEBUG org.hibernate.jdbc.AbstractBatcher -about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG org.hibernate.jdbc.AbstractBatcher -about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG org.hibernate.jdbc.AbstractBatcher -closing statement
DEBUG org.hibernate.loader.Loader -total objects hydrated: 0


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

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.