public class AccountTransferValueObject implements java.io.Serializable { private String customerPK; private String fromAccountPK; private String toAccountPK; private float amount; ... public String getCustomerPK(){ return customerPK; } public String getFromAccountPK(){ return fromAccountPK; } public String getToAccountPK(){ return toAccountPK; } public float getTransferAmount(){ return amount; } public void setCustomerPK(String customerPK){ this.customerPK = customerPK; } public void setFromAccountPK(String fromAccountPK){ this.fromAccountPK = fromAccountPK; } public void setToAccountPK(String toAccountPK){ this.toAccountPK = toAccountPK; } public void setTransferAmount(float amount){ this.amount = amount; } }
有了值对象,客户端在需要传递数据时候,就把所有的数据打包在值对象中,然后通过网络发送到EJB层,经过Session Facade Bean交给业务逻辑处理。同样当业务逻辑与客户端交互时,EJB层就会创建一个值对象来包装业务方法需要传递的数据,通过Session Façade Bean传递给客户端。