Uhh.... injection again. Not in my repertoire as of writing :-) I'm using this code from within a subclass of CayenneDataObject, so I don't know who created the DataContext that this CayenneDataObject lives in.
Can I get from a CayenneDataObject to a CayenneRuntime? I coded up the below which allows me to create a new DataContext with only the information in a DataContext: /** Duplicate code from deprecated method as we have no other way * to create a new DataContext based on an existing one. */ public static DataContext createDataContext(DataContext dataContext) { DataDomain r = dataContext.getParentDataDomain(); DataRowStore snapshotCache = r.isSharedCacheEnabled() ? r.getSharedSnapshotCache() : new DataRowStore(r.getName(), r.getProperties(), r.getEventManager()); DataContext context = new DataContext(r, new ObjectStore(snapshotCache)); context.setValidatingObjectsOnCommit(r.isValidatingObjectsOnCommit()); return context; } -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International +47 51 87 40 27 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer