-->
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.  [ 2 posts ] 
Author Message
 Post subject: Get Warning: afterTransactionCompletion() was never called
PostPosted: Mon Oct 27, 2003 6:11 am 
Beginner
Beginner

Joined: Fri Sep 26, 2003 2:50 am
Posts: 32
My code is following,
Code:
        Session session = null;
        java.sql.Connection con = null;
        Statement stmt = null;
        ResultSet rs = null;
        try {
            session = getSession();   // a tools methods that get session from ThreadLocal

            session.beginTransaction();

            con = session.connection();
            stmt = con.createStatement();

            //... execute some native SQL operation using statement

            //commit the transaction
            con.commit();
        } catch(Exception ex) {
            ex.printStackTrace();
            if( con != null ) {
                try {
                    //rollback the transaction
                    con.rollback();
                } catch(Exception e) { }
            }
        } finally {
            if( rs != null ) {
                try {
                    rs.close();
                } catch(Exception ex) { }
            }

            if( stmt != null ) {
                try {
                    stmt.close();
                } catch(Exception ex) { }
            }
        }


When i run this code, some message are displayed, the messages is belong to hibernate, like following,
Code:
2003-10-27 17:50:08 net.sf.hibernate.impl.SessionImpl finalize
warn: afterTransactionCompletion() was never called


but my operations are all successful, how about these messages?

Thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 27, 2003 7:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Please re-read the documentation.

Your code should look like:

Transaction tx = session.beginTransaction();

....

tx.commit();


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