I have a Stateless session bean on which a method is called from a servlet. The method in the Bean does a bunch of stuff and then when it want to access the Db it creates Dao objects by passing the EnitityManager which has been injected in this bean.
This Bean is supposed to write 4 different things to different tables in the single same operation, but fails on the last item and throws an exception. It turns out that it does not rollback the 3 it wrote.
My setting for the Hibernate peroperties in the persistence.properties file is:
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup hibernate.connection.release_mode=after_statement hibernate.transaction.flush_before_completion=false hibernate.transaction.auto_close_session=false hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory hibernate.hbm2ddl.auto=update #hibernate.hbm2ddl.auto=create-drop #hibernate.hbm2ddl.auto=create hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider # Clustered cache with TreeCache #hibernate.cache.provider_class=org.jboss.ejb3.entity.TreeCacheProviderHook #hibernate.treecache.mbean.object_name=jboss.cache:service=EJB3EntityTreeCache #hibernate.dialect=org.hibernate.dialect.HSQLDialect hibernate.connection.datasource=java:/TheranosDS hibernate.dialect=org.hibernate.dialect.MySQLDialect hibernate.jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory hibernate.jndi.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces hibernate.bytecode.use_reflection_optimizer=false # I don't think this is honored, but EJB3Deployer uses it hibernate.bytecode.provider=javassist
Sorry forgot to mention that, I'm running JBoss 4.0.5 and JDK5