Dear Friends, My Architecture requires that I should have a Web Container (Catalina) and Application Container(JBoss). To reduce the trafic across the container I am using the Value Objects. Now conceptually this is Okay... but now can anybody help me.... where to store the Value Objects and who will manage the object lifecycle
Shashank Hiwarkar<br />SCJP, SCWCD
Joined: Mar 17, 2000
Value objects are your transport objects. Typically you should not store them for long since they may get stale quickly. They are returned by methods on the business services layer and can be used by a View Helper to generate a presentation view. Front end controllers and action classes can package Value Objects in the Httpsession. [ May 13, 2003: Message edited by: Ajith Kallambella ]
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
The Value Object pattern has been renamed "Transfer Object" by sun. (http://java.sun.com/blueprints/patterns/TransferObject.html) I think this new name makes its use easier to understand. The transfer object is used to transfer an ejb's data from one container to another efficiently. The only objects storing the transfer objects would the the web container's objects (servlets, jsp, struts actions, whatever) and then they won't be storing them very long. A good use is to have your entity or stateful ejb have a method that returns the entire transfer object (which has the name data as if you called each getter on your ejb). This is only one remote call that returns one serializable object instead of all those remote calls for each getter. You can also have a setter that takes in a transfer object so there is only one remote call. Small sample code: EJB ----- -foo -bar -baz ------ +getTO:TO +setTO:void Here's your transfer object TO ----- -foo -bar -baz So your client would get an ejb and then call getTO to get all the data. They could display the data or modify it and send it back to the ejb with setTO.