Hi Marina,
the object is simply created by creating a new object:
UploadedFile file = new UploadedFile();
file.setFilename("test.txt");
...
...
Persisted:
entityManager.persist(file);
And then in a different transaction:
UploadedFile file= entityManger.find(UploadedFile.class, new
UploadedFilePK(pathid,filename));
file.setFilename("new_name");
entityManager.setFlushMode(FlushModeType.COMMIT);
entityManager.flush();
The only difference with the object that does work seems to be that I use a
composite primary key on this object and a new key is created in the find()
function to locate the object.
With regards,
Peter Havelaar
----- Original Message -----
From: "Marina Vatkina" <Marina.Vatkina_at_Sun.COM>
To: <persistence_at_glassfish.dev.java.net>
Sent: Tuesday, August 15, 2006 7:08 PM
Subject: Re: Object is not written to the database....
Hi Peter,
We need to see the code that creates/persists/flushes that object to be
able to help.
thanks,
-marina
Peter Havelaar wrote:
> I am in the middle of development and find that there is a certain
> object that doesn't synchronize changes to the database.
> The object is created and removed properly, but fails to update any
> changes to any of the fields.
> A very similar object uses similar code to change some properties and
> strangely this object has no problem synchronizing its new state to the
> database...
> I have been trying to find out what the problem is but I cannot find it.
>
> Does anyone have a suggestion?
>
> ** I set the flushmode to COMMIT and perform a flush straight after the
> object is updated.
> ** The entitymanager is container managed
> ** The object does show the correct changes while the object is in the
> cache
> ** No object relations are present
>
> With regards,
> Peter Havelaar
> Jabbah.net