You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Marc Logemann <li...@logemann.org> on 2009/05/04 21:47:01 UTC

automatic merge / persist

Hi,

suppose the following code:

@Transactional
public void bar() {
foo();
}

public void foo() {
MyJPAEntity entity = someJPADao.getEntity();
entity.setName("foo");
}


When running this code, would you expect that entity gets persisted /  
updated? In method "foo", the object entity is a detached instance of  
MyJPAEntity when coming back from the DAO. And now i really wonder why  
this detached instance gets "merged" (aka updated) when i leave bar().

I migrated my codebase from Kodo/JDO and there, MyJPAEntity wouldnt  
have been updated without an explicit re-attach. Any explanations  
welcome.

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de