选择显示字体大小

ejb设计模式1

   第一个设计模式非常简单。一个公司和雇员的entity bean和
下面给出的entity bean的代码片断是类似的。它们是由jbuilder4的
entitybean模版生成的。所有的字段都声明为public的cmp字段。

code snippet for company entity bean
public class companybean implements entitybean {
entitycontext entitycontext;
public integer comid; //the primary key
public string comname; //the company name
public string comdescription //basic description
public timestamp mutationdate //explained later
public integer ejbcreate(<params>) throws
createexception {
return null;
}
//various get() and set() for every column/field
// which are exposed in the remote interface as well
code snippet for employee entity bean
public class employeebean implements entitybean {


entitycontext entitycontext;
public integer empid; //the primary key
public integer comid; //the company foreign key
public string empfirstname; //the employee firstname
public string emplastname // the employee lastname
public timestamp mutationdate //explained later
public integer ejbcreate(<params>) throws
createexception {
return null;
}

//various get() and set() for every column/field
// which are exposed in the remote interface as well
这个设计模式虽然很简单,但是却有很多缺点,比如,对每一个
字段的访问都会导致对get()和set()方法的一次远程调用。而远
程过程调用(rpcs)是非常耗费资源的,并且,对于在实际中通
常要求的组合的访问会导致一系列的远程调用。可以说,这个模
式在实际中可用性很差。上面展示的设计模式可以作为其他设计
模式的基础,比如rad,原型设计,测试等。这时,那个代表雇
员的employee entity bean并没有展示出在雇员和公司之间有何
关系。





 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons