I created a thread for uploading a bucket of data into a database, but when passing a EntityManager from a JPA class to the thread class, the EntityManager was always closed. (The EntityManager is fine in my JPA class, only closed when passing to the thread class).
Any suggestions would be appreciated.
09:45:32,638 SEVERE [biblio] java.lang.IllegalStateException: EntityManager is closed at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:66) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:46) at $Proxy2107.persist(Unknown Source)
|