| View previous topic :: View next topic |
| Author |
Message |
Tomer Ben-David Guest
|
Posted: Mon Aug 11, 2003 6:21 am Post subject: Value Object and Entity Beans |
|
|
Hi
Im a newbie :)
Here is an implementation that one EJB engine has generated (I
manipulated abit added one property but generaly it was generated by
it...) :
* @ejb.interface-method view-type="local"
* @--ejb.transaction type="Required"
* @ejb.permission unchecked="true"
**/
public UserInfoEntityData getValueObject()
{
UserInfoEntityData valueObj = new UserInfoEntityData();
valueObj.setUsername(getUsername());
valueObj.setSex(getSex());
return valueObj;
}
Now Im wondering its doing "new UserInfoEntityData()" that means that
if multiple clients connect to my server call this getValueObject then
every one of those clients will get a different reference to a
different value object.
So different clients can update different details on different value
objects! however i want (ofcourse!) all of them to be synchronized
with the same data!!
Am I missing something about value objects? aren't they synchronized
around clients?
Thanks in advance,
Tomer
|
|
| Back to top |
|
 |
Øyvind Matheson Wergeland Guest
|
Posted: Mon Aug 11, 2003 7:24 am Post subject: Re: Value Object and Entity Beans |
|
|
Tomer Ben-David wrote:
| Quote: | Now Im wondering its doing "new UserInfoEntityData()" that means that
if multiple clients connect to my server call this getValueObject then
every one of those clients will get a different reference to a
different value object.
|
Yes.
| Quote: | So different clients can update different details on different value
objects!
|
Yes. Also note that a client merely updating a value object changes
nothing on the server side or in the database.
| Quote: | however i want (ofcourse!) all of them to be synchronized
with the same data!!
Am I missing something about value objects?
|
Yes.
| Quote: | aren't they synchronized around clients?
|
No.
Either, don't use value objects if it is not necessary for performance,
or use user transactions in the clients where updating value objects.
--
Øyvind Matheson Wergeland Just Another Virtual Application
Senior System Developer
Manamind AS Creating the Corporate Information Feed [tm]
|
|
| Back to top |
|
 |
Marek Lange Guest
|
Posted: Mon Aug 11, 2003 7:43 am Post subject: Re: Value Object and Entity Beans |
|
|
Øyvind Matheson Wergeland wrote:
| Quote: | Tomer Ben-David wrote:
Now Im wondering its doing "new UserInfoEntityData()" that means that
if multiple clients connect to my server call this getValueObject then
every one of those clients will get a different reference to a
different value object.
Yes.
So different clients can update different details on different value
objects!
Yes. Also note that a client merely updating a value object changes
nothing on the server side or in the database.
|
That's the point. Value objects are used to pass data from server to
client and vice versa. Changing a value object does not mean to change
the database data.
-marek
|
|
| Back to top |
|
 |
|