J2EE Pattern ValueObject and EJBs with local Interfaces
Is it useful to use the J2EE Design Pattern with EJBs that have local Interfaces?
Example:
variant 1
a entiy bean (with local interfaces) creates a value object with its attributes. Another ejb (with local interfaces) gets the value object with one method call.
variant 2
The client (in this case another ejb with local interfaces) accesses the getters from the entity bean direct, e.g. getAttribute1(), ... getAttributeX()
It is really usefull to create first a value object or it is better to access the attributes direct, because it works all in the same ejb-container and no extra network effort must be done
Thanks
[682 byte] By [
RKlinger] at [2007-9-26 18:45:25]

I still always perfer VOs. It keeps the EJBs loosly coupled, and allows for future felability. Should you ever decide to change your design, i.e. use multiple containers, your performance is definitly imporved by passing VOs instead of direct method inovcations.
Also, I've read that even in the same container, RMI overhead is still increased with multiple direct method calls, and VOs are still recommended.
Lastly, I find that using VOs in general provide additional benefits, asside from that mentioned above. For instance, if I decide to validate data before passing it around, I can add an 'isValid()' method to the VO which checks its data against business fules. I can cast a VO to another object for polymorphism, I can have the VO implement common interfaces, and so one and so forth. In other words, in keeping with the object oriented appraoch to life, everything is an object!
Where multiple data items logically belong together, and cannot exist w/o the contect of the others, I create VOs. Everywhere a business object is identified w/in the app, I tend to create a VO structure/heirarcy (e.g. forms, invoices, user accounts, etc.
bRi