技术控

    今日:60| 主题:49312
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Migrating EJB2 Entity Beans to EJB3 and JPA

[复制链接]
零食戒了 发表于 2016-10-6 07:58:17
222 5

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Scenario: you have to migrate all of the EJB2 Entity Beans from a legacy project to EJB3 Entity Beans with JPA. Hibernate will be your JPA implementation and Spring Framework cannot be used. No other layer that the EJB2 Entity Beans layer will be migrated.
   The application also contains an EJB2 Session Beans layer. This one will not be replaced, but updated to work with the new EJB3 Entity Beans. (Note: this article will not explain the J2EE architecture. If you want to find more about that, please check here . Please take the patterns presented in the link with a grain of salt. Some of them are obsolete, but some still make sense.)
   Assumption: The 10K feet view of your legacy back end layers looks like below:
   
Migrating EJB2 Entity Beans to EJB3 and JPA-1 (available,presented,Business,article,please)

   EmployeeDelegate: a Business Delegate pattern implementation and it is the only class that exposes the available functionality to a client. More about the Business Delegate pattern here .
   initializeEmployeeSessionFacadeHome: a function that will locate and create the  EmployeeSessionFacadeHome and return an EmployeeSessionFacade interface.
   EmployeeSessionFacadeBean: the session facade that will actually contain the functionality exposed by EmployeeSessionFacade .
   findEmployeeHome: is the function responsible for finding the EJB2 Entity Bean for working with employee data. This function will return EmployeeHome which is an interface.
   EmployeeBean: is actually the class that contains the code to save and remove and work with employee data.
  Now, the standard classes and interfaces of an Employee EJB2 CMP entity bean are shown below:

Migrating EJB2 Entity Beans to EJB3 and JPA-2 (available,presented,Business,article,please)

   EmployeeHome: used to locate the bean and define the create and remove operations.
   EmployeeBean: the entity bean that is actually managed by the container and implements the operations.
   Employee: is the local interface of the bean.
   EmployeeDTO: a data transfer object used to transfer data between various layers.
  (Note: I will not detail here what an EJB 2 Entity Bean is or how it is configured.)
   If you want to find out more about this subject, please check the official documentation .
   Migrating Employee Bean From EJB 2.1 to EJB 3

  This is assuming that you want to do this while keeping EmployeeSessionFacade as an EJB 2 session facade bean.
  When migrating the new EJB 3 entity beans, I will try to expose the same functions as the old EJB 2 Entity Beans were exposing in order to minimize the changes in the other layers that are using that beans.
  The specifications for EJB 3 Entity Beans also mention the Home Local and Remote interfaces.
123下一页
友荐云推荐




上一篇:我为什么反对提 “全栈工程师”?
下一篇:编程思想之消息机制
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

垂婷丞松 发表于 2016-10-19 02:15:35
拍脑袋决策,拍胸脯保证,拍屁股走人.
回复 支持 反对

使用道具 举报

雷天航 发表于 2016-10-19 04:40:48
1v1飘过
回复 支持 反对

使用道具 举报

山柏 发表于 2016-11-8 15:35:58
零食戒了是一个典型的文艺青年啊!
回复 支持 反对

使用道具 举报

天天万新奇 发表于 2016-11-17 19:02:51
我就是路过,拿积分走人!!
回复 支持 反对

使用道具 举报

aghag 发表于 2016-11-20 19:13:35
为什么我躺着也中枪
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表