session « Glassfish « JPA Q&A





1. hibernate session in glassfish 2.1    coderanch.com

4. org.hibernate.SessionException:Session is closed!    java.net

javax.persistence.PersistenceException: org.hibernate.SessionException: Session is closed! at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630) at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:510) at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:99) at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:158) at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2548) at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:278) at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:249) at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:623) at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:309) at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:1030) at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:397) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3792) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3585) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1354) at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1316) at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:205) at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:127) at $Proxy142.processingFailed(Unknown Source) at com.sonybmg.aoma.transactionmanager.impl.MetadataImporterImpl.executeAttempt(MetadataImporterImpl.java:197) 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:585) at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067) at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176) at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895) at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986) ...

6. Glassfish and Hibernate: How to have each transction use its own session    java.net

I have a method, annotated with TransactionAttributeType.REQUIRES_NEW, that loops through a list of tasks and performs some business related work. When it is done, it calls a helper method, also annotated with TransactionAttributeType.REQUIRES_NEW, to record some performance information. I want this in its own transaction because even if I can't save the performance data, I still want to commit the business ...

7. hibernate session in glassfish 2.1    forum.hibernate.org

public class HibernateSessionFactoryUtil { private static final SessionFactory sessionFactory; static { try { sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } }