Hi Lon, We'll need to review this. All this used to worked before.
Andrus > On Feb 26, 2019, at 1:00 PM, Lon Varscsak <[email protected]> wrote: > > I always forget this part, I'm working off of 4.1.M3-SNAPSHOT > > On Tue, Feb 26, 2019 at 10:54 AM Lon Varscsak <[email protected]> > wrote: > >> Hey all, >> >> A few weeks ago I posted an email about a bug when serializing, and I >> never really looked much more in to it. However, I've now encountered a >> different issue if I'm using Map based data objects. If I have a data >> object, access a relationship, then serialize the object (and it's >> DataContext) then deserialize the object and then try to access the >> relationship again, I get this exception: >> >> java.lang.NullPointerException >> >> at org.apache.cayenne.util.RelationshipFault.isTransientParent( >> RelationshipFault.java:69) >> >> at org.apache.cayenne.util.PersistentObjectList.isFault( >> PersistentObjectList.java:76) >> >> at org.apache.cayenne.util.PersistentObjectList.resolvedObjectList( >> PersistentObjectList.java:318) >> >> at org.apache.cayenne.util.PersistentObjectList.iterator( >> PersistentObjectList.java:221) >> >> at com.smarthealth.cayennetest.App.main(App.java:53) >> >> >> It appears that the relationshipOwner variable on the ToManyList object is >> null (which is an invalid state). If I switch to field based objects, I >> have no exception and things work as expected. Also if I don't access the >> relationship before serialization, then there is no error on >> deserialization. >> >> You can download a test application here: >> https://ds.varscsak.com:5001/d/f/473447192107950173 >> >> If you want to flip between Map based and Field based, you can update the >> pom.xml file (you'll see that commented out in the build section) and >> trigger a build which should trigger the cgen task (doesn't always work for >> me, so sometimes I just delete the _ files and that's enough to trigger a >> rebuild). >> >> I'm pretty comfortable switching to field based objects, but feel like >> this should be addressed (or at least understood). >> >> Thanks for your time, >> >> Lon >>
