-->
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.  [ 13 posts ] 
Author Message
 Post subject: afterTransactionCompletion() Warning
PostPosted: Thu Feb 19, 2004 3:33 am 
Newbie

Joined: Mon Nov 17, 2003 3:50 pm
Posts: 19
I'm getting the below after I update/save a record. Is this normal?

WARN [net.sf.hibernate.impl.SessionImpl] - <afterTransactionCompletion() was never called>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 4:04 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Did you properly close your session & tx

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 11:21 pm 
Newbie

Joined: Mon Nov 17, 2003 3:50 pm
Posts: 19
Yes, I closed the session. I'm using ThreadLocal.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 4:15 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Then show your code

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 4:48 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I got that problem too, but - as usual - it was my fault (see below)

Anyway, WHY ON EARTH is this a warning, not an error, or even better - a BIG FAT exception? In my case, absolutely nothing was commited, yet I got only a tiny innocent warning.

Kinda hard to spot since I was running log4J on the error/fatal level....


Anyway... perhaps you are doing the same thing:

myfunc()
{
tx.begin()

// ... blah, blah, blah ...

if(something)
{

tx.commit();
}

// ooooooooooopssss - > commit never called if something is false

}


If would be nice if hibernate could extend log4J logging to include the stack trace is these cases - to make it easier to spot where things like this happend.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 6:08 pm 
Newbie

Joined: Mon Nov 17, 2003 3:50 pm
Posts: 19
I'm using jboss and mysql and has auto commit turned on, so I don't have to call commit(). If I do call commit, then I get the exection that it has already been committed. So is the warning a flaw in hibernate if you have auto commit turned on?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 8:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
please search the forum for "autocommit". You shnould NEVER EVER use autocommit in a real application.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 26, 2004 6:22 am 
Beginner
Beginner

Joined: Mon Mar 29, 2004 12:41 pm
Posts: 26
Hi !

I have the same thing, but the data are modified correctly in the DB... Huuhh just a thing : Is this correct ? (pseudo code)

Code:
In case of readonly in DB access :
public aMethodToRead(){

    session.beginTransaction();

    session.load(aMappedObject);

    session.flush();
    session.close();
}

In case of write in DB access :
public aMethodToWrite(){

    session.beginTransaction();
   
    session.save(aMappedObject);

    try{
         tx.commit();
    }catch(HibernateException he){
         tx.rollBack()
    }
   
    session.flush();
    session.close();
}


Are the tx.commit() and session.flush() methods necessary in case of readonly request in the DB ?

Thank you !


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 29, 2004 6:27 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
yes is is mandatory. But this is not related to hibernate

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 30, 2004 10:33 am 
Newbie

Joined: Thu Dec 30, 2004 10:06 am
Posts: 1
Hi everyone, i'm running hibernate with oracle 9i and i'm getting the [net.sf.hibernate.impl.SessionImpl] afterTransactionCompletion() was never called only with this engine. I also use Ms SqlServer and IMB Db2 , but i don't get that warning with neither engines. I read on the web that this was an oracle jdbc driver bug when using connection pools, and this could be solved using jakarta's dbcp.
Anybody had this problem? Could this really be an oracle driver bug? I've read the thread twice and i still can't figure it out.

Thanks in advance.

Mat


Top
 Profile  
 
 Post subject: afterTransactionCompletion() when using c3p0 connection pool
PostPosted: Fri Mar 04, 2005 11:10 am 
Newbie

Joined: Fri Mar 04, 2005 10:53 am
Posts: 1
Hi!

I get the warning above when I use the c3p0 connection pool When I remove my c3p0 configuration from hibernate.cfg.xml, the warnings disappear.

I assume this is because I should call the statement above after a successful commit(), but it isn't defined in the Session interface.

Can somebody explain to me why I don't get this warning in my logs when the c3p0 connection isn't used?

I get the same warnings using Hibernate 3.0 rc1 or Hibernate 2.1. I switched to Hibernate 3 to se if that is an error that was fixed or not.

The warning is logged from the finalize() method in org.hibernate.jdbc.JDBCContext or net.sf.hibernate.impl.SessionImpl depending on the Hibernate version being used.

When searching the forum on this subject, all I find is discussion stating that you should close your session. Verifying that I do that haven't lead me to a solution.

/Thomas


Top
 Profile  
 
 Post subject: Re: afterTransactionCompletion() when using c3p0 connection
PostPosted: Tue Apr 05, 2005 2:17 pm 
Newbie

Joined: Sat Nov 13, 2004 2:33 am
Posts: 3
thomas.sundberg@gamefeder wrote:
Hi!

I get the warning above when I use the c3p0 connection pool When I remove my c3p0 configuration from hibernate.cfg.xml, the warnings disappear.

When searching the forum on this subject, all I find is discussion stating that you should close your session. Verifying that I do that haven't lead me to a solution.

/Thomas


I would like to confirm these finding above. I do close the session after commiting the transaction and the warning persists

WARN JDBCContext:250 - afterTransactionCompletion() was never called

using Java 1.5 lates revision and Hibernate 3.0 production release, code that produses the error runs in eclipse 3.1 in windows XP.
/hannes


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 8:21 am 
Beginner
Beginner

Joined: Wed May 05, 2004 3:26 am
Posts: 25
Anything new on the subject? :/

_________________
The Bits Control The Atoms


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