subject: [Hibernate] Session cannot be generated outside of transaction scope
premise: I have Stateless session bean that utilizes container managed transactions. This particular method requires a transaction. I am using Hibernate for dataaccess. my code is as follows: | | private String getSessionFactoryContext() throws NamingException | { | String value = null; | Context ctx = new InitialContext(); | Context environment = (Context)ctx.lookup("java:comp/env"); | value = (String) environment.lookup("sessionFactory"); | return value; | } | | public Session getCurrentSession(String sessionFactory) | { | return HibernateContext.getSession(sessionFactory); | } | | public ValueObject myEJBBusinessMethod() | { | Session session = getCurrentSession(getSessionFactoryContext()); | ... | | When I call the myEJBBusinessMethod I get the error, the first line throws an exception with the following detailed message: "Session cannot be generated outside of transaction scope" I am simply trying to use container managed transactions within a remote stateless session bean with my session bean using hibernate, but I get that error, does anybody have a code example about the proper configuration. I already spent about 5 hours trolling for the answer. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872426#3872426 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3872426 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user