-->
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: update warning: unclosed connection: Timing problem?
PostPosted: Wed Dec 29, 2004 4:02 am 
Newbie

Joined: Tue Sep 14, 2004 11:18 am
Posts: 10
I use Hibernate 3 Beta and have the following method to insert objects.

public synchronized long create(Persistable obj) throws IOException
{
long id = -1;
try {
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
id = ((Long)session.save(obj)).longValue();
logger.warn("crea1");
tx.commit();
session.close();
logger.warn("crea2");
} catch(Exception ex) { throw new IOException("Error creating object:"
+ obj + "\r\n" + ex.toString()); }
return id;
}

This method works. If, however, I remove the two logging statements the execution results in:
"WARN - unclosed connection, forgot to call close() on your session?"

This is reproducible and happens for my update-method as well.


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.