正在加载图片...
ooAD大报告之 Petstore中EB的设计模式分析 2.1.1.意图 Decouple business logic from data access logic and adapt the resource being accessed, so that the type of resource can change easily and independently. 减弱业务层的数据访问逻辑,使其与数据层的耦合度降低,从而可以方便灵活的改变 数据资源的形式 2.1.2.动机 These problems can be avoided by removing data access logic from enterprise beans and abstracting data access functionality into a separate interface. Enterprise beans carry out their business logic in terms of operations on that interface, which is implemented by a data access object (DAO) appropriate for the type of resource being used.(就是业务逻辑中不 负责数据的存取,把它放到DAO中,这些数据的格式,提供商一旦发生改变,只 需修改DAO即可) For example, the Java Pet Store application's OrderEJB component accesses a database through its associated OrderDAO class, which knows how to perform load, save, and find operations on order data in the persistent store. Because the bean delegates its persistence-related tasks to the DAO, it can concentrate on implementing business methods At deployment time the application administrator configures the implementation of OrderDAO to be one of OrderDAOCS, OrderDAOOracle, or OrderDAOSybase, depending on whether an Cloudscape, Oracle, or Sybase database is used. No matter what choice is made. the orderejb is unaffected because it is programmed to an interface not to an implementation 不过我们现在使用的是JB6.0+ Weblogic6。1开发bmp,我们大多使用了JB的向导 它自动生成了代码,可是它没有实现这种模式在 Session bean中我们封装了JDBC 的数据读取,有点向这种模式 作者:张玉平,吴小静,范赟梦,张麒,罗晟,张翅OOAD 大报告之 PetStore 中 EJB 的设计模式分析 作者: 张 玉 平 , 吴 小 静 , 范 赟 梦 , 张麒,罗晟, 张 翅 4 2.1.1. 意图 Decouple business logic from data access logic and adapt the resource being accessed, so that the type of resource can change easily and independently. 减弱业务层的数据讵问逻辑,使其不数据层的耦合度降低,仍而可以方便灵活的改变 数据资源的形式。 2.1.2. 劢机 These problems can be avoided by removing data access logic from enterprise beans and abstracting data access functionality into a separate interface. Enterprise beans carry out their business logic in terms of operations on that interface, which is implemented by a data access object (DAO) appropriate for the type of resource being used. (就是业务逻辑中丌 负责数据的存取,把它放到DAO 中,这些数据的格式,提供商一旦发生改变,叧 需修改DAO 即可) For example, the Java Pet Store application's OrderEJB component accesses a database through its associated OrderDAO class, which knows how to perform load, save, and find operations on order data in the persistent store. Because the bean delegates its persistence-related tasks to the DAO, it can concentrate on implementing business methods. At deployment time, the application administrator configures the implementation of OrderDAO to be one of OrderDAOCS, OrderDAOOracle, or OrderDAOSybase, depending on whether an Cloudscape, Oracle, or Sybase database is used. No matter what choice is made, the OrderEJB is unaffected, because it is programmed to an interface, not to an implementation. 丌过我们现在使用的是JB6.0+Weblogic6。1开发bmp,我们大多使用了JB 的向导, 它自劢生成了代码,可是它没有实现这种模式.在SessionBean 中我们封装了JDBC 的数据读取,有点向这种模式
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有