[jboss-user] [JBoss Seam] - Re: How to get EntityManager without @In?

gothmog do-not-reply at jboss.com
Fri Aug 31 07:22:01 EDT 2007


Thanks for the suggestions, I tried the beginCall() ... endCall() on the lifecycle and yes that does work, I can get an EntityManager in my thread however back to the original problem, the entity manager has not started a transaction for me, so nothing gets posted to the db and when I flush I get


  | 23:15:43,708 ERROR [STDERR] Exception in thread "Thread-21" 
  | 23:15:43,708 ERROR [STDERR] javax.persistence.TransactionRequiredException: no transaction is in progress
  | 23:15:43,708 ERROR [STDERR]     at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:293)
  | 23:15:43,708 ERROR [STDERR]     at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:90)
  | 23:15:43,708 ERROR [STDERR]     at model.EXAccessPoint.flushToDb(EXAccessPoint.java:236)
  | 23:15:43,708 ERROR [STDERR]     at model.EXBackgroundThread.run(EXBackgroundThread.java:36)
  | 23:15:44,282 INFO  [EXAccessPoint] calculateEx():from=11:15:39 PM;now=11:15:44 PM;exs.size()=3;currentStartIndex=2
  | 

The code inside the thread does this at the moment


  | Lifecycle.beginCall();
  | EntityManager em = (EntityManager)Component.getInstance("em", true);
  | ...
  | em.persist(...);
  | ...
  | em.flush();
  | Lifecycle.endCall();	
  | 

I'll try JNDI directly...

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

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



More information about the jboss-user mailing list