-->
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: Session to early closed (flushed?) after sequence selection
PostPosted: Wed Jun 22, 2005 3:30 am 
Newbie

Joined: Tue May 17, 2005 4:54 am
Posts: 15
Location: Germany, Karlsruhe
Hi,

I often encounter problems which are due to a premature close of the session - however, this is automatically done by Hibernate and leads to Transaction errors! I use the SessionUtil of the CaveatEmptor (SE).

In my case, I try to insert an object:
Code:
      SessionUtil.beginTransaction();
      Session session = SessionUtil.getSession();
      p = (Person) session.load(Person.class, p.getId());
      session.delete(p);
      SessionUtil.commitTransaction();
      SessionUtil.closeSession();


Sometimes everything works fine, and then suddenly I get the mentioned transaction errors (see log below) or I even cannot add objects because they cannot be identified by Hibernate anymore.

The sequence for the object to be deleted (in this case) is derived from a Postgresql-Sequence.


I need your help ...


Hibernate version: 3.05
Name and version of the database you are using: Postgres 7.4
Full stack trace of any exception that occurs:
[STDOUT] Hibernate: select nextval ('sq_personen_id')
09:16:11,831 INFO [STDOUT] null:
Session is closed

Debug level Hibernate log excerpt:

Code:
2005-06-22 09:16:11,805 INFO  [STDOUT] Hibernate: select nextval ('sq_personen_id')
2005-06-22 09:16:11,805 DEBUG [org.hibernate.jdbc.AbstractBatcher] preparing statement
2005-06-22 09:16:11,806 DEBUG [org.hibernate.id.SequenceGenerator] Sequence identifier generated: 17
2005-06-22 09:16:11,806 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-06-22 09:16:11,806 DEBUG [org.hibernate.jdbc.AbstractBatcher] closing statement
2005-06-22 09:16:11,806 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] generated identifier: 17, using strategy: org.hibernate.id.SequenceGenerator
2005-06-22 09:16:11,806 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] saving [xxxxxxx..Person#17]
2005-06-22 09:16:11,807 DEBUG [xxxxxxx.SessionUtil] Committing database transaction of this thread.
2005-06-22 09:16:11,807 DEBUG [org.hibernate.transaction.JDBCTransaction] commit
2005-06-22 09:16:11,807 DEBUG [org.hibernate.impl.SessionImpl] automatically flushing session
2005-06-22 09:16:11,807 DEBUG [org.hibernate.jdbc.JDBCContext] before transaction completion
2005-06-22 09:16:11,807 DEBUG [org.hibernate.impl.SessionImpl] before transaction completion
2005-06-22 09:16:11,830 DEBUG [xxxxxxx.SessionUtil] Trying to rollback database transaction of this thread.
2005-06-22 09:16:11,830 DEBUG [org.hibernate.transaction.JDBCTransaction] rollback
2005-06-22 09:16:11,830 DEBUG [org.hibernate.jdbc.JDBCContext] before transaction completion
2005-06-22 09:16:11,830 DEBUG [org.hibernate.impl.SessionImpl] before transaction completion
2005-06-22 09:16:11,830 DEBUG [org.hibernate.jdbc.JDBCContext] after transaction completion
2005-06-22 09:16:11,830 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
2005-06-22 09:16:11,830 DEBUG [org.hibernate.impl.SessionImpl] after transaction completion
2005-06-22 09:16:11,831 INFO  [STDOUT] null:
Session is closed
2005-06-22 09:16:11,831 DEBUG [xxxxxxx.SessionUtil] Closing Session of this thread.
2005-06-22 09:16:11,831 DEBUG [org.hibernate.impl.SessionImpl] closing session
2005-06-22 09:16:11,831 DEBUG [org.hibernate.jdbc.ConnectionManager] closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2005-06-22 09:16:11,831 DEBUG [org.hibernate.connection.DriverManagerConnectionProvider] returning connectionto pool, pool size: 1



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.