Results 1 to 5 of 5
  1. #1
    orchid's Avatar
    orchid is offline Member
    Join Date
    Apr 2007
    Location
    Midwest
    Posts
    60
    Rep Power
    0

    Default Hibernate issue with transaction

    Am getting a message in my log file sometimes that says:
    12:43:34,400 WARN [SessionImpl] afterTransactionCompletion() was never called
    The app is running fine but this does not look like a good message. I have a finally block after all my try/catch blocks where I open sessions. I close the session in them.
    Java Code:
    try
            {
                session = DBUtil.getSession();
                tx = session.beginTransaction();
               //some code here
                session.save(mydomainobject);
                tx.commit();
            }
            catch (Exception e)
            {
               rollback(t);
            }
            finally
            {
                closeSession(session);
            }
    So I am not sure why I am still getting seeing this warning in the log.
    Has anyone else had this and successfully fixed it?

  2. #2
    derrickD is offline Member
    Join Date
    Apr 2007
    Location
    USA
    Posts
    50
    Rep Power
    0

    Default

    This can be a tricky thing to figure out. Are you using more than one session somehow? Using threads? Are you using c3po ? I think the problem could be related to any of those things. It will probably take quite a bit of debugging on your part. Off hand I do not see anything wrong with your code. Maybe someone else has a more definitive answer .

  3. #3
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default

    what do you have inside closeSession(session) method ?
    If it is just session.close() ,
    Then I will join with pegitha

  4. #4
    orchid's Avatar
    orchid is offline Member
    Join Date
    Apr 2007
    Location
    Midwest
    Posts
    60
    Rep Power
    0

    Default

    My closeSession method looks like this:
    Java Code:
     public static void closeSession(Session sess)
        {
            try
            {
                if (sess != null)
                    sess.close();
            }
            catch (Exception ignored) 
            {
               logger.error("Failed to close session/conn");
            }
        }
    but I do not see that logger error in my log when I get the afterTransaction message. I have grepped for it.

  5. #5
    goldhouse is offline Senior Member
    Join Date
    Mar 2007
    Posts
    134
    Rep Power
    0

    Default

    You are sure that there is some exception and your logger is working fine

Similar Threads

  1. JFormattedTextField Issue
    By teracomp in forum AWT / Swing
    Replies: 1
    Last Post: 01-21-2008, 07:55 PM
  2. Try Catch issue
    By curtis_fraser in forum Advanced Java
    Replies: 2
    Last Post: 12-14-2007, 12:04 AM
  3. Issue
    By chaitu444 in forum New To Java
    Replies: 2
    Last Post: 11-06-2007, 08:49 PM
  4. Replies: 2
    Last Post: 06-30-2007, 04:01 PM
  5. compilation issue
    By orchid in forum Eclipse
    Replies: 2
    Last Post: 04-20-2007, 01:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •