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....
Andre
-
Value objects, where do I use them? (3 messages)
- Posted by: Andre van Ham
- Posted on: July 03 2002 19:45 EDT
Threaded Messages (3)
- Value objects, where do I use them? by qing yan on July 03 2002 20:30 EDT
- Value objects, where do I use them? by Kodandapani Sripathi on July 05 2002 07:25 EDT
- Value objects, where do I use them? by Andre van Ham on July 05 2002 17:27 EDT
-
Value objects, where do I use them?[ Go to top ]
- Posted by: qing yan
- Posted on: July 03 2002 20:30 EDT
- in response to Andre van Ham
Session Bean ...using specialized factory object if necessary. -
Value objects, where do I use them?[ Go to top ]
- Posted by: Kodandapani Sripathi
- Posted on: July 05 2002 07:25 EDT
- in response to Andre van Ham
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!!
cheers, -
Value objects, where do I use them?[ Go to top ]
- Posted by: Andre van Ham
- Posted on: July 05 2002 17:27 EDT
- in response to Kodandapani Sripathi
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!
Andre