开发者

What is the meaning of an "attached" object in JDO/DataNucleus?

The DataNucleus docs talk a lot about detached objects and what it means to be detached, but, for new users, they kind of skip over the simplistic: What does it mean to be attached?

http://www.datanucleus.org/products/accesspl开发者_Go百科atform_1_1/jdo/attach_detach.html

If I perform:

MyPersistableObj p = pm.makePersistent(myNewPersistableObj);

If I understand correctly, I'm getting back a copy of the object that was just posted to the database, but how that is special is a bit fuzzy.

  • If I make a change to one of the fields of that object, does that automatically cause an update to the database? The docs seem to hint at this, but don't call it out in particular.
  • Do I need to "detach" it to ensure this doesn't happen?
  • How does this (JDO's attach/detach functionality) differ from SQL, where I'm used to simple-to-understand, atomic, inserts, queries, updates, and deletes?


JDO object lifecycle is well defined in http://www.datanucleus.org/products/accessplatform_2_2/jdo/object_lifecycle.html "attached" is simply 'managed by the PersistenceManager' so a state like "Persistent Clean"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜