Hi Tilmann, > (sorry for double posting, I sent this to an...@apache.org before)
I haven't used the Apache email for years since Apache gets loads of spam; I'd guess it goes to /dev/null on my ISP :-) > I started looking into adapting datanucleus for JDO JIRA 747: > https://issues.apache.org/jira/browse/JDO-747 > > Some time ago you offered to give some initial pointers, could you tell > me where to start? > > My first goal: Update datanuclues so that a PERSISTENT_NEW object > transitions to PERSISTENT_CLEAN when they are refreshed _and_ if there > is an object with the same ID in the database. The first place to look is the StateManager, which is in "datanucleus-core" at https://github.com/datanucleus/datanucleus-core/blob/master/src/main/java/org/datanucleus/state/StateManagerImpl.java The transition in Lifecycle states for JDO is controlled from "datanucleus-api-jdo", in this package https://github.com/datanucleus/datanucleus-api-jdo/tree/master/src/main/java/org/datanucleus/api/jdo/state I'd guess you need to look at class PersistentNew.java (the state the object is in) and look for a method transitionRefresh(), which looks like it uses the default implementation (do nothing) currently. FYI DataNucleus JPA has an equivalent set of Lifecycle states over in "datanucleus-api-jpa", so if changing anything in the lifecycle states for JDO (in datanucleus-api-jdo) then this will not affect DataNucleus JPA usage (a good thing). Beyond those, some other classes that you may need to be aware of are ExecutionContext (does the work of the PM), here https://github.com/datanucleus/datanucleus-core/blob/master/src/main/java/org/datanucleus/ExecutionContextImpl.java Transaction (for the ExecutionContext) https://github.com/datanucleus/datanucleus-core/blob/master/src/main/java/org/datanucleus/TransactionImpl.java Hope that helps -- Andy DataNucleus (Web: http://www.datanucleus.org Twitter: @datanucleus)