I don't know, do I want an ExtendedEntityManager to do this?

Basically, what is the perferred way to obtaining an EntityManager in a POJO 
running within JBoss?

Doing:


  | InitialContext ctx = new InitialContext();
  | EntityManager em = (EntityManager) 
ctx.lookup("java:/EntityManagers/TestEM");
  | 

Returns an EntityManager of type InjectedEntityManager.  Which I guess is fine 
but I get an IllegalStateException if I call:


  | em.getTransaction(); (to begin() & commit()/rollback())
  | 

And if I don't call em.getTransaction() and just call em.find(...) I get a 
TransactionRequiredException.

Damn if I do damn if I don't!

Thanks again for any suggestions!
Mike


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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to