浏览 3800 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-04-07
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.@persistcontext(unit......) EntityManager em; this do not work,every time the variable em is null; 2.@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. 不好意思,因为在jboss论坛上发了这个帖子,所以没翻译就贴了过来.我已经搜索了很久,没有找到解决办法.请版主不用删我的帖子. 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2007-04-07
不要用annotation阿,直接lookup
|
|
返回顶楼 | |
发表时间:2007-04-08
我使用
... context.lookup ("persistentunitname"); 或者: context.lookup ("java:/persistentunitname"); 注:persistentunitname是占位符 都无法lookup到那个实体管理器,在jboss的jndiview下也看不到那个persistentunitname. 请问要怎样lookup.谢谢 |
|
返回顶楼 | |