persistence@glassfish.java.net

Re: Object is not written to the database....

From: Craig L Russell <Craig.Russell_at_Sun.COM>
Date: Tue, 15 Aug 2006 10:30:26 -0700

Hi Peter,

The only thing I can think of is to make sure that the instance in
question is actually managed by the persistence context. Is it
possible that the instance is detached (i.e. left over from a
previous transaction)?

Can you try verifying that the instance is managed?

print("Object is managed: " + em.contains(instance));

Craig

On Aug 15, 2006, at 8:54 AM, 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
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell_at_sun.com
P.S. A good JDO? O, Gasp!