-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate won't persist my object
PostPosted: Tue May 04, 2004 6:44 pm 
Newbie

Joined: Tue May 04, 2004 6:34 pm
Posts: 5
I'm trying to write a test application that simply persists and object to the database through the hibernate framework but it's currently not going into the database. By turning on the verbose debugging I see that Hibernate correctly determines that it's a new object and generates the primary key for it (via postgresql sequences), it then tells me it has saved the object but I never see the sql generated for the insert, and nothing goes into the database. Any idea's on what might be causing this, or the next steps to take in debugging.

See snippet of log file below...


2004-05-04 15:25:45,579 DEBUG net.sf.hibernate.impl.SessionImpl - opened session
2004-05-04 15:25:45,754 DEBUG net.sf.hibernate.impl.SessionImpl - find: from UserAccount u where u.emailAddress=?
2004-05-04 15:25:45,758 DEBUG net.sf.hibernate.engine.QueryParameters - parameters: [test@test.com]
2004-05-04 15:25:45,761 DEBUG net.sf.hibernate.engine.QueryParameters - named parameters: {}
2004-05-04 15:25:45,779 DEBUG net.sf.hibernate.hql.QueryTranslator - compiling query
2004-05-04 15:25:45,811 DEBUG net.sf.hibernate.hql.QueryTranslator - HQL: from com.activerain.model.UserAccount u where u.emailAddress=?
2004-05-04 15:25:45,814 DEBUG net.sf.hibernate.hql.QueryTranslator - SQL: select useraccoun0_.user_id as user_id, useraccoun0_.email_address as email_ad2_, useraccoun0_.password as password, useraccoun0_.receive_html_email as receive_4_, useraccoun0_.contact_info_id as contact_5_, useraccoun0_.is_deleted as is_deleted, useraccoun0_.insert_date as insert_d7_, useraccoun0_.update_date as update_d8_, useraccoun0_.delete_date as delete_d9_ from user_account useraccoun0_ where (useraccoun0_.email_address=? )
2004-05-04 15:25:45,817 DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-05-04 15:25:45,819 DEBUG net.sf.hibernate.SQL - select useraccoun0_.user_id as user_id, useraccoun0_.email_address as email_ad2_, useraccoun0_.password as password, useraccoun0_.receive_html_email as receive_4_, useraccoun0_.contact_info_id as contact_5_, useraccoun0_.is_deleted as is_deleted, useraccoun0_.insert_date as insert_d7_, useraccoun0_.update_date as update_d8_, useraccoun0_.delete_date as delete_d9_ from user_account useraccoun0_ where (useraccoun0_.email_address=? )
2004-05-04 15:25:45,821 DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
2004-05-04 15:25:45,838 DEBUG net.sf.hibernate.loader.Loader - processing result set
2004-05-04 15:25:45,841 DEBUG net.sf.hibernate.loader.Loader - done processing result set (0 rows)
2004-05-04 15:25:45,843 DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-05-04 15:25:45,845 DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
2004-05-04 15:25:45,848 DEBUG net.sf.hibernate.loader.Loader - total objects hydrated: 0
2004-05-04 15:25:45,851 DEBUG net.sf.hibernate.impl.SessionImpl - initializing non-lazy collections
2004-05-04 15:25:45,861 DEBUG net.sf.hibernate.impl.SessionImpl - saveOrUpdate() unsaved instance
2004-05-04 15:25:45,865 DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-05-04 15:25:45,867 DEBUG net.sf.hibernate.SQL - select nextval ('user_sequence')
2004-05-04 15:25:45,869 DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
2004-05-04 15:25:45,921 DEBUG net.sf.hibernate.id.SequenceGenerator - Sequence identifier generated: 26
2004-05-04 15:25:45,924 DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-05-04 15:25:45,926 DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
2004-05-04 15:25:45,929 DEBUG net.sf.hibernate.impl.SessionImpl - generated identifier: 26
2004-05-04 15:25:45,933 DEBUG net.sf.hibernate.impl.SessionImpl - saving [com.activerain.model.UserAccount#26]
2004-05-04 15:25:45,942 DEBUG net.sf.hibernate.impl.SessionImpl - loading [com.activerain.model.UserAccount#26]
2004-05-04 15:25:45,944 DEBUG net.sf.hibernate.impl.SessionImpl - attempting to resolve [com.activerain.model.UserAccount#26]
2004-05-04 15:25:45,947 DEBUG net.sf.hibernate.impl.SessionImpl - resolved object in session cache [com.activerain.model.UserAccount#26]
2004-05-04 15:25:46,580 DEBUG net.sf.hibernate.impl.SessionImpl - closing session
2004-05-04 15:25:46,583 DEBUG net.sf.hibernate.impl.SessionImpl - disconnecting session
2004-05-04 15:25:46,586 DEBUG net.sf.hibernate.impl.SessionImpl - transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 04, 2004 9:09 pm 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
did you read the red stuff? Prob be good to give us some code. This is also a FAQ item. Most likely you didn't flush, or if using transactions, tx.commit()

--James


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 1:40 pm 
Newbie

Joined: Tue May 04, 2004 6:34 pm
Posts: 5
That seems to be the problem, the session isn't getting flushed. When I flush it manually it works but I'm using the spring framework that is supposed to take care of that automatically for me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.