-->
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: SESSION IS CLOSED
PostPosted: Fri Jan 05, 2007 8:46 am 
Newbie

Joined: Tue Dec 19, 2006 5:25 am
Posts: 9
When I commit the transaction, I get the error below:

Code:
Exception in thread "main" org.hibernate.SessionException: Session was already closed
   at org.hibernate.impl.SessionImpl.close(SessionImpl.java:270)
   at business.commands.LockParagraph.ejecutar(LockParagraph.java:88)
   at business.commands.Invoker.ejecutar(Invoker.java:21)
   at business.Services.lockParagraph(Services.java:403)
   at business.TranformerInputOutput.lockParagraph(TranformerInputOutput.java:298)
   at business.TranformerInputOutput.main(TranformerInputOutput.java:45)


The code is the next, I must be forgotting something:
Code:
ParagraphDAO paragraphDAO=(ParagraphDAO)new ParagraphDAO().getInstance();
        try
        {
            session=paragraphDAO.getSession();
            //s.flush();
           
            tx=session.beginTransaction();
           
            Paragraph para=paragraphDAO.get(id);
            if(para.isLock())
            {
                throw (new ViolationLockingParagraph());
            }
            else
            {
                para.setLock(true);
            }
            paragraphDAO.saveOrUpdate(para);
           
            //tx.commit();           
           
            parameterList.put("LOCKPARAGRAPH_RESUL",para);
        }
        catch(Exception excep)
        {           
            if(tx!=null)
            {
                try
                {
                    tx.rollback();
                }
                catch(HibernateException hibernateExcep)
                {
                    System.out.println("EXCEPCTION, in LockParagraph class, closing transaction: "+hibernateExcep.getMessage());
                    hibernateExcep.printStackTrace();
                    throw hibernateExcep;
                }
            }   
            System.out.println("Exception in class LockParagraph: "+excep.getMessage());
            excep.printStackTrace();   
        }
        finally
        {
            try
            {
                session.close();
            }
            catch(HibernateException hibernateException)
            {
                throw hibernateException;
            }
        }



Many thanks.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 8:53 am 
Newbie

Joined: Fri Jul 21, 2006 7:20 am
Posts: 15
Your session got closed in the class LockParagraph.java at linenumber 88. See why it closed there.


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.