Hi All
I am using Hibernate with JPA in Jboss 7.1.
I created my Hibernate session using the following codings
EntityManagerFactory emf = Persistence.createEntityManagerFactory("test"); EntityManager em = emf.createEntityManager(); Session s = em.unwrap(Session.class);
It is working fine.
Now at the end when I was trying to close the Session and EntityManager
s.close(); if(em.isOpen()) { em.close(); }
I get below exception while closing the EntityManager.
ERROR [stderr] (MSC service thread 1-3) org.hibernate.SessionException: Session was already closed ERROR [stderr] (MSC service thread 1-3) at org.hibernate.internal.SessionImpl.close(SessionImpl.java:266) ERROR [stderr] (MSC service thread 1-3) at org.hibernate.ejb.EntityManagerImpl.close(EntityManagerImpl.java:152)
Can anyone identify the problem ?
Thanks in advance.
Wrong forum - this one is for Envers only.
Adam