persistence@glassfish.java.net

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

From: Peter Havelaar <peter-java_net_at_jabbah.net>
Date: Tue, 15 Aug 2006 20:21:10 +0200

Hi Craig,

yes the object is managed. The object is also first retreived from the entity manager by the use of find().
Though a composite primary key is used. This is different from the other object that does work. This object only has an int as the primary key.

Regards,
Peter Havelaar

  ----- Original Message -----
  From: Craig L Russell
  To: persistence_at_glassfish.dev.java.net
  Sent: Tuesday, August 15, 2006 7:30 PM
  Subject: Re: Object is not written to the database....


  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!