A question to all you more experienced EJB designers :
Let's say I have a couple of Entity Beans with a Session Bean Facade. The client is accessing the Session Bean Facade and gets a Value Object returned.
Where do I marshall this Value Object? In the Session Bean or is it Best Practice to do it in the Entity Bean?
I can imagine reasons for both approaches : If you do it in the Session Beans (which are more or less application specific) you can decide which attributes to expose. On the other hand, if you do it in the Entity Bean your having to do less calls from the Session Bean to the Entity Bean (is this creating much overhead with localinterfaces?).
I realise I'm asking a lot at once, but an answer to these questions is vital to me since I am deciding what technology to choose for my companies mission-critical applications. So far j2ee gives me the feeling I'm much more in control then .NET....
Session Bean ...using specialized factory object if necessary.
I should say, its going to depend on the context.
Irrespective of that, I hope your Entity bean has a bulk accessor in place. In the sense, a method that would return all the attributes in one value object.
Assuming the above bulk accessor is in place, now it boils down to your more specific requirements. If you are looking at creating a value-object which is a very small subset of your master list of attributes, it makes sense calling individual entity bean methods and then martialling them at session bean level.
Or, if you have a major set of attributes to be sent across and you definitely dont want to send some attributes (assuming your application demands that way), then make a bulk access from entity bean and customise it again in session bean.
In all other cases, it is better to make a bulk access on entity bean and send the same value object across.
Hope, its clear!!
Okay, that's clear. Hadn't thought of it that way.
I'm going to use the bulk accessor in the entitybean and modify the valueobject in the sessionbean if necessary.
Many thanks for your ideas!