Hello!
I got a problem/unexpected behaviour using a dvc object:
After creating a cmp entity bean containing a dvc object consisting of two "String"s I can access the EJB as well as the dvc object.
Then I change the dvc object using the following code:
(Example 1-not working)
DVClass dvcobject = this.getDVCObject();
dvcobject.stringone = "hello".
this.setDVCObject(dvcobject);
Result: the "old" object is written back/updated to the database and the ejb.
When I change the Code:
(Example 2-OK)
DVClass dvcobject = (this.getDVCObject()).clone();
dvcobject.stringone = "hello".
this.setDVCObject(dvcobject.clone());
Everything works OK. According to Chapter 10.3.3 of the ejb-2.0 specs getDVCObject() return a copy of the object. So after changing the Object is has to be written back.
Could anyone please tell me if I'm reading the specs wrong or something...
Thanks,
-Gunnar