Folks,
I just noticed the following behavior and wonder if there are preferred
patterns for dealing with it. I've got an entity bean which can
presumably be accessed by remote client-side code (e.g. in another VM)
or by session beans running in the jboss server VM. Let's say the
entity bean has some code like so:
private Money moola;
/**
* @remote-method
*/
Money getMoney() {
return moola;
}
I noticed that the remote client code gets a copy of moola but the
server-side session bean gets a reference to the member itself (and can
thus change it). This makes sense but it does mean that the behavior is
different for in-VM client code and remote client code. Is this
"standard" EJB behavior? One approach to trade some efficiency for
safety would be as follows:
Money getMoney() {
return new Money( moola);
}
This way the clients would be unable to modify the private member even
if they were running in the same VM. Are there other approaches?
TIA,
Toby Cabot
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user