if (dirty && !myLC.isDeleted() && myLC.isTransactional() && myOM.isDelayDatastoreOperationsEnabled())
{
// Already provisionally persistent, but delaying til commit so just re-run reachability
// to bring in any new objects that are now reachable
provideFields(cmd.getAllMemberPositions(), new PersistFieldManager(this, false));
return;
}
getCallbackHandler().prePersist(myPC);
if (isFlushedNew())
{
// With CompoundIdentity bidir relations when the SM is created for this object ("initialiseForPersistentNew") the persist
// of the PK PC fields can cause the flush of this object, and so it is already persisted by the time we ge here
registerTransactional();
return;
}
if (cmd.isEmbeddedOnly())
{
// Cant persist an object of this type since can only be embedded
return;
}
// If this is an embedded/serialised object becoming persistent in its own right, assign an identity.
if (myID == null)
{
setIdentity(false);
}
dirty = true;
if (myOM.isDelayDatastoreOperationsEnabled())
{
// Delaying datastore flush til later
myOM.markDirty(this, false);
if (NucleusLogger.PERSISTENCE.isDebugEnabled())
{
NucleusLogger.PERSISTENCE.debug(LOCALISER.msg("026028", StringUtils.toJVMIDString(myPC)));
}
registerTransactional();
if (myLC.isTransactional() && myLC.isDeleted())
{
// Re-persist of a previously deleted object
myLC = myLC.transitionMakePersistent(this);
}
// TODO Only run this if we have relations from this class
// Run reachability on all fields of this PC - JDO2 [12.6.7]
provideFields(cmd.getAllMemberPositions(), new PersistFieldManager(this, false));
}
else
{
// Persist the object and all reachables
internalMakePersistent();