Hi, I'm having similar problems, but I'm not using EJB3, just EJB2 session beans + Hibernate persistence.
Something that Steve Ebersole said in the JIRA (http://jira.jboss.com/jira/browse/JBAS-1828) caught my attention. I have been using following pattern when using hibernate from session beans (This is session bean method with Transaction="Required"): | public void addPaper(Paper paper) { | try { | HibernateUtil.beginTransaction(); | HibernateUtil.getSession().save(paper); | HibernateUtil.commitTransaction(); | } catch (HibernateException e) { | HibernateUtil.rollbackTransaction(); | throw new InfrastructureException(e); | } finally { | HibernateUtil.closeSession(); | } | } | HibernateUtil is from "Hibernate in Action", it fetches SessionFactory from JNDI: java:hibernate/SessionFactory. This worked with JBoss 4.0.1 and Hibernate2, but when I upgraded to JBoss 4.0.2 and Hibernate3, saves, updates and deletes are not working. If I don't do HibernateUtil.closeSession(), database gets updated, but I get warning: [CachedConnectionManager] Closing a connection for you. Please close them yourself Which makes me wonder: What is the right pattern for using hibernate from a session bean? I have read about HibernateContext, but if I understand correctly it can only be used if method is transacted and I would like to keep code consistent in both transactional and non-transactional methods. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3878529#3878529 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3878529 ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user