In EJB 2.0, What are dependent value classes?

Siva Visveswaran

Value classes basically are a "happy" compromise between die-hard object encapsulation on the server-side and make-easy performance considerations on the client side.

For example, consider an EJB client requesting a customer addrees from a Customer EJB. Assume the customer address is a serializable object containing Street address, State, Zip, etc. You have 2 options - either pass the serializable object asis to the client over IIOP or provide individual methods on the Customer EJB that return each piece of information. While the first breaks encapsulation the second will be shot down by your architect for performance reasons! Also the scenario makes sense for inter-EJB calls as well to preserve encapsulation.

Enter value objects in EJB 2.0. Value objects are basically a client view of your persistent object. The Customer bean provider creates this view from the persistent representation. In order for the container to be able to create these instances, the appropriate IDL stubs must be deployed on the container when the bean is deployed. Optionally containers may download them on demand - the spec doesn't impose either alternative. For more details & examples, refer to the EJB 2.0 specification!

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact