[jboss-user] [EJB 3.0] - How to find a container managed entity manager through JNDI?
do-not-reply at jboss.com
Sat Apr 7 09:05:14 EDT 2007
I deployed a EAR under jboss4.0.5.GA.I have a ejb3.0 jar named a.jar which consists of three entity bean,and a web app named b.war in this ear.
I want use those entity bean in those servlets of b.war.In this case ,i do not want to use session bean.I hope can use entity bean in those servlets directory,not through session bean.Because i think those EntityBean and servlets are in the same jvm,even the same ear!To use session bean to bridge these ENTITYBEAN and servets ,is not gracefuly,and not efficiently,they are in the same ear!!
To achieve that ,I try to get a container managed entity manager in these servlets,I have tried two way use annotation,they are below:
1. at persistcontext(unit......)
this do not work,every time the variable em is null;
2. at resource(mappedname.....
in both case,i use the name of the persistent unit which defined in the persistent.xml of a.jar.
I searched many topics on google,never find a post which tell me to find a jboss managed entitymanager under jboss.But many posts said affirmatively " ...can get a container managed entity manager through jndi...",so i wonder :
a.jboss now do not surpport getting a container managed entity manager through jndi,or I used the wrong jndi name?
b.in which case can i use @persistcontext(unit......) or @resource(mappedname ,those two annotation to get a container managed entity manager ?
thank you very much for your help.I really do not want to use session bean for me,and do not want to create a app managed entitymanager under my jbossAS,it is absurd.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035513#4035513
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035513
More information about the jboss-user