Context
Application clients need to exchange data with enterprise beans.
Problem
Java 2 Platform, Enterprise Edition (J2EE) applications implement server-side
business components as session beans and entity beans. Some methods exposed by the
business components return data to the client. Often, the client invokes a business object's
get methods multiple times until it obtains all the attribute values.
Session beans represent the business services and are not shared between users. A
session bean provides coarse-grained service methods when implemented per the Session
Facade pattern.
Entity beans, on the other hand, are multiuser, transactional objects representing
persistent data. An entity bean exposes the values of attributes by providing an accessor
method (also referred to as a getter or get method) for each attribute it wishes to expose.
Every method call made to the business service object, be it an entity bean or a
session bean, is potentially remote. Thus, in an Enterprise JavaBeans (EJB) application such
remote invocations use the network layer regardless of the proximity of the client to the
bean, creating a network overhead. Enterprise bean method calls may permeate the network
layers of the system even if the client and the EJB container holding the entity bean are both
running in the same JVM, OS, or physical machine. Some vendors may implement
mechanisms to reduce this overhead by using a more direct access approach and bypassing
the network.
As the usage of these remote methods increases, application performance can
significantly degrade. Therefore, using multiple calls to get methods that return single
attribute values is inefficient for obtaining data values from an enterprise bean.
Forces
All access to an enterprise bean is performed via remote interfaces to the bean. Every
call to an enterprise bean is potentially a remote method call with network overhead.
Typically, applications have a greater frequency of read transactions than update
transactions. The client requires the data from the business tier for presentation, display, and
other read-only types of processing. The client updates the data in the business tier much
less frequently than it reads the data.
The client usually requires values for more than one attribute or dependent object
from an enterprise bean. Thus, the client may invoke multiple remote calls to obtain the
required data.
The number of calls made by the client to the enterprise bean impacts network
performance. Chattier applications-those with increased traffic between client and server
tiers-often degrade network performance.
Solution
Use a Transfer Object to encapsulate the business data. A single method call is used
to send and retrieve the Transfer Object. When the client requests the enterprise bean for the
business data, the enterprise bean can construct the Transfer Object, populate it with its
attribute values, and pass it by value to the client.
Clients usually require more than one value from an enterprise bean. To reduce the
number of remote calls and to avoid the associated overhead, it is best to use Transfer
Objects to transport the data from the enterprise bean to its client.
When an enterprise bean uses a Transfer Object, the client makes a single remote
method invocation to the enterprise bean to request the Transfer Object instead of numerous
remote method calls to get individual attribute values. The enterprise bean then constructs a
new Transfer Object instance, copies values into the object and returns it to the client. The
client receives the Transfer Object and can then invoke accessor (or getter) methods on the
Transfer Object to get the individual attribute values from the Transfer Object. Or, the
implementation of the Transfer Object may be such that it makes all attributes public.
Because the Transfer Object is passed by value to the client, all calls to the Transfer Object
instance are local calls instead of remote method invocations.
- 浏览: 14644 次
- 性别:
- 来自: 北京
文章分类
最新评论
发表评论
-
集成层模式:Service Activator—服务激发器模式
2014-04-09 20:31 1015ContextEnterprise beans and o ... -
集成层模式:Data Access Object—数据访问对象模式
2014-04-09 20:31 494ContextAccess to data varies ... -
业务层模式:Service Locator—服务定位器模式
2014-04-09 20:31 1136ContextService lookup and cre ... -
表示层模式:Value List Handler—值列表处理器模式
2014-04-09 20:32 749ContextThe client requires a ... -
表示层模式:Transfer Object Assembler—传输对象组装器模式
2014-04-10 22:48 724ContextIn a Java 2 Platform, ... -
业务层模式:Composite Entity—复合实体模式
2014-04-08 21:38 469ContextEntity beans are not i ... -
业务层模式:Session Facade—会话门面模式
2014-04-08 21:38 405ContextEnterprise beans encap ... -
业务层模式:Business Delegate—业务委托模式
2014-04-08 21:37 954ContextA multi-tiered, distri ... -
表示层模式:Dispatcher View—分发者视图模式
2014-04-08 21:37 515ContextSystem controls flow o ... -
表示层模式:Service to Worker—工作者服务模式
2014-04-07 10:48 958ContextThe system controls flow ... -
表示层模式:Front Controller—前端控制器模式
2014-04-07 10:45 351ContextThe presentation-tier re ... -
表示层模式:Composite View—复合视图模式
2014-04-07 10:41 461ContextSophisticated Web page ... -
表示层模式:View Helper—视图助手模式
2014-04-07 10:37 1002ContextThe system creates pre ... -
表示层模式:Intercepting Filter—拦截过滤器模式
2014-04-07 10:29 605Context The presentati ...
相关推荐
Self-taught Learning: Transfer Learning from Unlabeled Data
传输对象模式(Transfer Object Pattern)用于从客户端向服务器一次性传递带有多个属性的数据。传输对象也被称为数值对象。传输对象是一个具有 getter/setter 方法的简单的 POJO 类,它是可序列化的,所以它可以通过...
创建型模式 这些设计模式提供了一种在创建对象的同时隐藏创建逻辑的方式,而不是使用 new 运算符直接实例化对象。这使得程序在判断针对某个给定实例需要创建哪些对象时更加...传输对象模式(Transfer Object Pattern)
用Java实现23种设计模式 1. 创建型模式 工厂模式(Factory Pattern) 抽象工厂模式(Abstract Factory Pattern) ... 传输对象模式(Transfer Object Pattern) 生产者消费者模式(Producer Consumer Pattern)
数据传输对象 此类旨在使添加和查看数据变得容易。 加载对象、数组或json; 使用对象、数组或点符号读取; 输出到json字符串。 用法 您可以使用数组、可数组对象或 json 字符串实例化该类。 这些都是等价的: $ ...
ATM(Asynchronous Transfer Mode)异步传输模式。异步转移模式的特征是信息的传输、复用和交换都以信元为基本单位。异步是指属于同一用户的信元并不一定按固定的时间间隔周期性地出现。ATM信元是固定长度的分组,...
Laravel Castable数据传输对象 Laravel很棒。 SpatiePHP包很棒。 他们已经是好朋友,但现在他们的关系更上一层楼 :two_hearts: 您是否曾经想过将JSON列转换为值对象? 该软件包为您提供了Spatie的...
我们知道,Internet的基本协议是TCP/IP协议,然而在TCP/IP模型最上层的是应用层(Applicationlayer),它包含所有高层的协议。高层协议有:文件传输协议FTP、电子邮件传输协议SMTP、域名系统服务DNS、网络新闻传输协议...
PTP(Picture Transfer Protocol),图片传输协议。PTP是最早由柯达公司与微软协商制定的一种标准,符合这种标准的图像设备在接入Windows XP系统之后可以更好地被系统和应用程序所共享,尤其在网络传输方面,系统可以...
异步传输模式(ATM Asynchronous Transfer Mode)通信管理
java transfer filter 传输多种格式的文件 socket net send file and receive files
文件传输协议(File Transfer Protocol, FTP) FTP(File Transfer Protocol)是一种标准的网络协议,用于在不同的计算机系统之间传输文件。FTP 协议的主要目标是提高文件的共享性,提供非直接使用远程计算机,使...
2.尝试改动buff[]的大小能否加快传输速度 3.将接收界面的文件名限定长度 4.activity_main中,发送和接收字样模糊 5.接收完文件后,按钮不消失,变为背景为透明的含框已发送 6.只初始化一次数据库,重复打开不清空...
数据传输对象,Service层向上传输数据使用 BO Business Object 业务对象,Service输出的封装业务逻辑对象 AO Application Object 应用对象,Web层和Service层之间抽象的复用对象 VO View Object 显示层对象,Web向...
CAN 是 Controller Area Network(控制器局域网)的缩写。CAN 通信协议在 1986 年由 德国电气商博世公司所...1. CAN对象层(the object layer) 2. CAN传输层(the transfer layer) 3. CAN物理层(the phyical layer)
libusb 块传输 同步传输 例程,网上相关资源不多.
SpatiePHP数据传输对象包很棒。 他们已经是好朋友,但是现在他们将他们的关系带到了一个新的高度。:two_hearts:Laravel Castable数据传输对象Laravel很棒。 SpatiePHP数据传输对象包很棒。 他们已经是好朋友,但是...
一个人简单的文件传输FileTransfer
1、PO(persistant object) 持久对象 3、TO(Transfer Object) ,数据传输对象 4、DTO(Data Transfer O