[英]Calling an EJB3 library from an EJB2 library
I have an existing application that is written in EJB2.1. 我有一个用EJB2.1编写的现有应用程序。 This is deployed on jboss-5.1.0.GA as an EAR.
这部署在jboss-5.1.0.GA上作为EAR。
I now have a new requirement to implement a process which is supposed to be used by the EJB2.1 application. 我现在有了一个新的要求来实现一个应该由EJB2.1应用程序使用的进程。 Both will be in their own ear files but will both be running on the same jboss-5.1.0 instance.
两者都将在他们自己的ear文件中,但都将在同一个jboss-5.1.0实例上运行。
My questions are: 我的问题是:
The EJB3 specification allows a smooth transition,defining methods for EJB2/EJB3 interoperability, it's sometimes bulky and you will need artifacts not necessary in a 'normal' EJB3 app ( @RemoteHome
) EJB3规范允许平滑过渡,定义EJB2 / EJB3互操作性的方法,它有时很笨重,你需要在“普通”EJB3应用程序中不需要的工件(
@RemoteHome
)
- Is it possible to call the services of the EJB3 ear from the EJB2.1 ear?
是否可以从EJB2.1耳中调用EJB3 ear的服务?
Yes, it is possible, see: Referencing EJB3 beans in EJB2.1 and Introduction to using EJB2.1 client adaptors and the sample project "ejb21_client_adaptors" 是的,有可能,请参阅: 在EJB2.1中引用EJB3 bean以及使用EJB2.1客户端适配器和示例项目“ejb21_client_adaptors”的简介
- If the answer to the above is yes, is it possible to manage the transactions?
如果上述答案是肯定的,是否可以管理交易? ie only have the EJB2.1 application commit any transactions.
即只有EJB2.1应用程序提交任何事务。
Yes, just remember to annotate your EJB3 method with @TransactionAttribute(TransactionAttributeType.MANDATORY)
是的,只需记住使用
@TransactionAttribute(TransactionAttributeType.MANDATORY)
注释EJB3方法
- The EJB3 services will be called from session beans in the EJB2 application.
EJB3服务将从EJB2应用程序中的会话bean调用。 Is this the wrong way to do it?
这是错误的方法吗? (ie the session bean is not a client).
(即会话bean不是客户端)。
I see no problem here, session beans can call other beans' services. 我认为这里没有问题,会话bean可以调用其他bean的服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.