[jboss-user] [JBoss Seam] - Re: EntityManager: For newbies or to close gaps in your know

bfo81 do-not-reply at jboss.com
Wed Aug 16 13:14:42 EDT 2006


That's strange. http://fisheye.labs.jboss.com/viewrep/JBoss/jboss-seam/src/main/org/jboss/seam/util/Persistence.java?r=MAIN shows your code. But it doesn't work for me since getDelegate() returns an instance of org.hibernate.ejb.EntityManagerInstance. So I had to use this:

( (EntityManagerImpl) em.getDelegate() ).getSession().setFlushMode(FlushMode.NEVER);

Now there aren't any auto-flushes anymore. But: explicit calls of flush() don't work either.javax.persistence.TransactionRequiredException: no transaction is in progressSo I think you must explicitely open and close transactions... what is not only a bit silly since it makes me lose some of EJB3s convenience stuff. It even doesn't work for me now:
ejbCtx.getUserTransaction().begin()
em.getTransaction.begin()
( (EntityManagerImpl) em.getDelegate() ).getSession().beginTransaction()
 ( (EntityManagerImpl) em.getDelegate() ).getSession().getTransaction().begin()
... they all throw Exceptions

So this is where I'm stuck ^^.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965551#3965551

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3965551



More information about the jboss-user mailing list