[JBoss-user] [EJB 3.0] - Re: How to inject an EntityManager?

2006-01-26 Thread [EMAIL PROTECTED]
you can't inject arbitrarily into any class.  Injection works only into EJBs, 
interceptors, and when we support it, servlets/JSPs.  Relaly only enterprise 
components.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3919918#3919918

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3919918


---
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=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: How to inject an EntityManager?

2006-01-26 Thread osganian
Thanks for the reply.  So what are my choices?  Do I have to create an 
InitialContext and look up the EntityManager via JNDI?

I tried and I get an InjectedEntityManager back which throws an exception if I 
try and get the Transaction from it.  If I don't begin a transaction I get an 
TransactionRequiredException.  So what do I do?  Is it possible to get an 
ExtendedEntityManager versus an InjectedEntityManager?

Thanks for any help!
Mike

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3919922#3919922

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3919922


---
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=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: How to inject an EntityManager?

2006-01-26 Thread [EMAIL PROTECTED]
you want an extended entity manager?  Lookup the factory in jndi after you've 
declared jboss.entity.manager.factory.jndi.name and create it from the factory.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3919932#3919932

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3919932


---
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=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: How to inject an EntityManager?

2006-01-26 Thread osganian
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=bbop=viewtopicp=3919933#3919933

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=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=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB 3.0] - Re: How to inject an EntityManager?

2006-01-26 Thread [EMAIL PROTECTED]
sorry, i gave you directions on how to obtain factory/entitymanager for the 
next release which will hopefully be tomorrw.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3919944#3919944

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=3919944


---
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=lnkkid=103432bid=230486dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user