I'm converting an application from 3.0 to 3.1 and was fixing all the localObject() calls to be the simpler version introduced in 3.1. One thing I encountered was a utility method:
public static <T extends CayenneDataObject> T copyToContext(T cayenneObject, DataContext dataContext) { T copiedObject = dataContext.localObject(cayenneObject.getObjectId(), cayenneObject); // The returned copy is HOLLOW, make the copy NEW if the original is NEW. if (cayenneObject.getPersistenceState() == PersistenceState.NEW) copiedObject.setPersistenceState(PersistenceState.NEW); return copiedObject; } I tried removing this utility method and just use the new localObject(), but exceptions (such as FaultFailureException) started being thrown. (I won't even try to explain why so many local object copies of non-persisted objects are being used.) Anyone know why making a local object copy of a NEW object will set the copy to HOLLOW which will try to trigger faults later? Thanks, mrg