当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Chapter 5. Creating a BMP Entit
 

 

    摘要: terry chan(terrych@ca.ibm.com)软件工程师,ibm canada ltd.2003 年 1 月 学习如何将独立的、基于 swing 的编辑器作为插件集成到 eclipse platform 中。通过使用一些简单的技术,您就可以在 swing 工具、eclipse platform 和各种 swt 小窗口(widget)之间共享资源,而且这些资源可以通过相互知晓性(mu......
    摘要: struts开始于2000年3月,1.0在2001年7月发布。采用struts能开发出基于mvc(model-view-controller)设计模式的应用构架。mvc设计模式把一个系统分成3个相互协调的部分:model(模型)模型用于封装系统的状态view(视图)是模型的表示,提供用户交互界面。当模型状态发生变化时,视图应该得到通知,以便更新视图。controller(控制器)接受来自视图的请......


Tutorial for building J2EE Applications using JBOSS and ECLIPSE (5)

chapter 5.

creating a bmp entity bean 【程序编程相关:hibernate高级特性_1

【推荐阅读:J2EE项目危机【翻译】 -避免这10项

【扩展信息:JSP中文乱码问题的解决

this chapter describes how to create a bean managed persistence (bmp) ejb component. we will create two bmp beans, customer and manager, as shown below. the customer bean will be responsible for storing the details of customers of mystore. the manager bean stores details of the manager of mystore. both beans communicate with their respective tables in the database using data access objects (daos) named customerdao and managerdao respectively.

all customers have been assigned a unique customerid for housekeeping purposes in mystore in addition to their username for accessing the services of mystore. similarly the manager of mystore has been assigned a unique managerid.

note : it is the usual practice to access business methods of bmp beans via a session bean, which encapsulates business logic and acts as an interface to further ejb components. in this case customer and manager are accessible via by storeaccess.

this approach comes from a pattern called a session facade, whereby enterprise beans encapsulate business logic and business data and expose their interfaces. the session bean acts as a facade to encapsulate the complexity of interactions with the lower-level beans. the session facade is responsible for managing business objects and provides a uniform business service abstraction to presentation layer clients, thereby hiding the business object implementation in the lower-level beans.

this tutorial uses that pattern for business tier implementation.

tasks :

create a bmp bean named customer under package au.com.tusc.bmp.

create a dao class named customerdaoimpl under package au.com.tusc.dao.

add all attributes/properties to the customerbean, with getter and setter methods for each of the attributes.

add a finder method named ejbfindbyprimarykey with the signature

public customerpk ejbfindbyprimarykey (customerpk pk) throws finderexception

add a finder method named ejbfindbyuserid with the signature

public customerpk ejbfindbyuserid (string userid) throws finderexception

add a business method named getcustomerdata with the signature

public customerdata getcustomerdata()

implement required methods in the customerdaoimpl class.

deploy the customer bean.

add a create method to the storeaccess bean.

public void ejbcreate() throws javax.ejb.createexception

add a business method to the storeaccess bean.

public customerdata getcustomerdata(string userid)

create a test client named sessionbmpclient under package au.com.tusc.client.

run your client and test the bean.

create the customer bmp entity bean :

go to package explorer > expand mystore (project) node > select src, right click and a menu will pop up.

on the pop up menu > new > lomboz ejb creation wizard.

enter package name au.com.tusc.bmp, bean name customer and select bean type as bean manged entity > finish.


...   下一页
 ·linux上配置jdk+tomcat+mysql    »显示摘要«
    摘要: 一、 配置环境: redhat 8.0 jdk安装路径: /usr/jdk1.4.2 tomcat安装路径:/root/tomcat5.0/ mysql安装路径: /usr/local/mysql 总共分为以下几个步骤: 1、安装配置jdk1.4.2 2、安装配置tomcat5.0和测试3、安装mysql和测试 所需要的软件: 下载地址jdk: j2sdk-1_4_2_05-linux-i58......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE