cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [04/18] cayenne git commit: CAY-2330 Field based data objects
Date Fri, 11 Aug 2017 07:54:41 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/qualified/auto/_Qualified2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/qualified/auto/_Qualified2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/qualified/auto/_Qualified2.java
index c75b539..fd82379 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/qualified/auto/_Qualified2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/qualified/auto/_Qualified2.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.qualified.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.qualified.Qualified1;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.qualified.Qualified1;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Qualified2 extends CayenneDataObject {
+public abstract class _Qualified2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,18 +24,29 @@ public abstract class _Qualified2 extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<Qualified1> QUALIFIED1 = Property.create("qualified1", Qualified1.class);
 
+    protected Boolean deleted;
+    protected String name;
+
+    protected Object qualified1;
+
     public void setDeleted(Boolean deleted) {
-        writeProperty("deleted", deleted);
+        beforePropertyWrite("deleted", this.deleted, deleted);
+        this.deleted = deleted;
     }
+
     public Boolean getDeleted() {
-        return (Boolean)readProperty("deleted");
+        beforePropertyRead("deleted");
+        return deleted;
     }
 
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void setQualified1(Qualified1 qualified1) {
@@ -42,5 +57,67 @@ public abstract class _Qualified2 extends CayenneDataObject {
         return (Qualified1)readProperty("qualified1");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "deleted":
+                return this.deleted;
+            case "name":
+                return this.name;
+            case "qualified1":
+                return this.qualified1;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "deleted":
+                this.deleted = (Boolean)val;
+                break;
+            case "name":
+                this.name = (String)val;
+                break;
+            case "qualified1":
+                this.qualified1 = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(deleted);
+        out.writeObject(name);
+        out.writeObject(qualified1);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        deleted = (Boolean)in.readObject();
+        name = (String)in.readObject();
+        qualified1 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_QuoteAdress.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_QuoteAdress.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_QuoteAdress.java
index a62ef4d..cba1592 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_QuoteAdress.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_QuoteAdress.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.quotemap.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.quotemap.Quote_Person;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.quotemap.Quote_Person;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _QuoteAdress extends CayenneDataObject {
+public abstract class _QuoteAdress extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,18 +24,29 @@ public abstract class _QuoteAdress extends CayenneDataObject {
     public static final Property<String> GROUP = Property.create("group", String.class);
     public static final Property<Quote_Person> PERSON_REL = Property.create("person_Rel", Quote_Person.class);
 
+    protected String city;
+    protected String group;
+
+    protected Object person_Rel;
+
     public void setCity(String city) {
-        writeProperty("city", city);
+        beforePropertyWrite("city", this.city, city);
+        this.city = city;
     }
+
     public String getCity() {
-        return (String)readProperty("city");
+        beforePropertyRead("city");
+        return city;
     }
 
     public void setGroup(String group) {
-        writeProperty("group", group);
+        beforePropertyWrite("group", this.group, group);
+        this.group = group;
     }
+
     public String getGroup() {
-        return (String)readProperty("group");
+        beforePropertyRead("group");
+        return group;
     }
 
     public void setPerson_Rel(Quote_Person person_Rel) {
@@ -42,5 +57,67 @@ public abstract class _QuoteAdress extends CayenneDataObject {
         return (Quote_Person)readProperty("person_Rel");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "city":
+                return this.city;
+            case "group":
+                return this.group;
+            case "person_Rel":
+                return this.person_Rel;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "city":
+                this.city = (String)val;
+                break;
+            case "group":
+                this.group = (String)val;
+                break;
+            case "person_Rel":
+                this.person_Rel = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(city);
+        out.writeObject(group);
+        out.writeObject(person_Rel);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        city = (String)in.readObject();
+        group = (String)in.readObject();
+        person_Rel = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_Quote_Person.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_Quote_Person.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_Quote_Person.java
index 32e734a..0f32540 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_Quote_Person.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/quotemap/auto/_Quote_Person.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.quotemap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Date;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.quotemap.QuoteAdress;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.quotemap.QuoteAdress;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Quote_Person extends CayenneDataObject {
+public abstract class _Quote_Person extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -25,39 +28,62 @@ public abstract class _Quote_Person extends CayenneDataObject {
     public static final Property<Integer> SALARY = Property.create("salary", Integer.class);
     public static final Property<QuoteAdress> ADDRESS_REL = Property.create("address_Rel", QuoteAdress.class);
 
+    protected Date dAte;
+    protected String fULL_name;
+    protected String group;
+    protected String name;
+    protected Integer salary;
+
+    protected Object address_Rel;
+
     public void setDAte(Date dAte) {
-        writeProperty("dAte", dAte);
+        beforePropertyWrite("dAte", this.dAte, dAte);
+        this.dAte = dAte;
     }
+
     public Date getDAte() {
-        return (Date)readProperty("dAte");
+        beforePropertyRead("dAte");
+        return dAte;
     }
 
     public void setFULL_name(String fULL_name) {
-        writeProperty("fULL_name", fULL_name);
+        beforePropertyWrite("fULL_name", this.fULL_name, fULL_name);
+        this.fULL_name = fULL_name;
     }
+
     public String getFULL_name() {
-        return (String)readProperty("fULL_name");
+        beforePropertyRead("fULL_name");
+        return fULL_name;
     }
 
     public void setGroup(String group) {
-        writeProperty("group", group);
+        beforePropertyWrite("group", this.group, group);
+        this.group = group;
     }
+
     public String getGroup() {
-        return (String)readProperty("group");
+        beforePropertyRead("group");
+        return group;
     }
 
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void setSalary(Integer salary) {
-        writeProperty("salary", salary);
+        beforePropertyWrite("salary", this.salary, salary);
+        this.salary = salary;
     }
+
     public Integer getSalary() {
-        return (Integer)readProperty("salary");
+        beforePropertyRead("salary");
+        return salary;
     }
 
     public void setAddress_Rel(QuoteAdress address_Rel) {
@@ -68,5 +94,88 @@ public abstract class _Quote_Person extends CayenneDataObject {
         return (QuoteAdress)readProperty("address_Rel");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "dAte":
+                return this.dAte;
+            case "fULL_name":
+                return this.fULL_name;
+            case "group":
+                return this.group;
+            case "name":
+                return this.name;
+            case "salary":
+                return this.salary;
+            case "address_Rel":
+                return this.address_Rel;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "dAte":
+                this.dAte = (Date)val;
+                break;
+            case "fULL_name":
+                this.fULL_name = (String)val;
+                break;
+            case "group":
+                this.group = (String)val;
+                break;
+            case "name":
+                this.name = (String)val;
+                break;
+            case "salary":
+                this.salary = (Integer)val;
+                break;
+            case "address_Rel":
+                this.address_Rel = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(dAte);
+        out.writeObject(fULL_name);
+        out.writeObject(group);
+        out.writeObject(name);
+        out.writeObject(salary);
+        out.writeObject(address_Rel);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        dAte = (Date)in.readObject();
+        fULL_name = (String)in.readObject();
+        group = (String)in.readObject();
+        name = (String)in.readObject();
+        salary = (Integer)in.readObject();
+        address_Rel = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_Reflexive.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_Reflexive.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_Reflexive.java
index 8ab8644..9a4238d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_Reflexive.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_Reflexive.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.reflexive.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.reflexive.Reflexive;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.reflexive.Reflexive;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Reflexive extends CayenneDataObject {
+public abstract class _Reflexive extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,25 +25,34 @@ public abstract class _Reflexive extends CayenneDataObject {
     public static final Property<List<Reflexive>> CHILDREN = Property.create("children", List.class);
     public static final Property<Reflexive> TO_PARENT = Property.create("toParent", Reflexive.class);
 
+    protected String name;
+
+    protected Object children;
+    protected Object toParent;
+
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void addToChildren(Reflexive obj) {
         addToManyTarget("children", obj, true);
     }
+
     public void removeFromChildren(Reflexive obj) {
         removeToManyTarget("children", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Reflexive> getChildren() {
         return (List<Reflexive>)readProperty("children");
     }
 
-
     public void setToParent(Reflexive toParent) {
         setToOneTarget("toParent", toParent, true);
     }
@@ -49,5 +61,67 @@ public abstract class _Reflexive extends CayenneDataObject {
         return (Reflexive)readProperty("toParent");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "children":
+                return this.children;
+            case "toParent":
+                return this.toParent;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "name":
+                this.name = (String)val;
+                break;
+            case "children":
+                this.children = val;
+                break;
+            case "toParent":
+                this.toParent = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(name);
+        out.writeObject(children);
+        out.writeObject(toParent);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        children = in.readObject();
+        toParent = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_FkOfDifferentType.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_FkOfDifferentType.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_FkOfDifferentType.java
index 0573abf..33129d9 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_FkOfDifferentType.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_FkOfDifferentType.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships.RelationshipHelper;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships.RelationshipHelper;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _FkOfDifferentType extends CayenneDataObject {
+public abstract class _FkOfDifferentType extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _FkOfDifferentType extends CayenneDataObject {
 
     public static final Property<RelationshipHelper> RELATIONSHIP_HELPER = Property.create("relationshipHelper", RelationshipHelper.class);
 
+
+    protected Object relationshipHelper;
+
     public void setRelationshipHelper(RelationshipHelper relationshipHelper) {
         setToOneTarget("relationshipHelper", relationshipHelper, true);
     }
@@ -26,5 +33,53 @@ public abstract class _FkOfDifferentType extends CayenneDataObject {
         return (RelationshipHelper)readProperty("relationshipHelper");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "relationshipHelper":
+                return this.relationshipHelper;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "relationshipHelper":
+                this.relationshipHelper = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(relationshipHelper);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        relationshipHelper = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_MeaningfulFK.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_MeaningfulFK.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_MeaningfulFK.java
index 97e939a..37b13c0 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_MeaningfulFK.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_MeaningfulFK.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships.RelationshipHelper;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships.RelationshipHelper;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MeaningfulFK extends CayenneDataObject {
+public abstract class _MeaningfulFK extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +23,18 @@ public abstract class _MeaningfulFK extends CayenneDataObject {
     public static final Property<Integer> RELATIONSHIP_HELPER_ID = Property.create("relationshipHelperID", Integer.class);
     public static final Property<RelationshipHelper> TO_RELATIONSHIP_HELPER = Property.create("toRelationshipHelper", RelationshipHelper.class);
 
+    protected Integer relationshipHelperID;
+
+    protected Object toRelationshipHelper;
+
     public void setRelationshipHelperID(Integer relationshipHelperID) {
-        writeProperty("relationshipHelperID", relationshipHelperID);
+        beforePropertyWrite("relationshipHelperID", this.relationshipHelperID, relationshipHelperID);
+        this.relationshipHelperID = relationshipHelperID;
     }
+
     public Integer getRelationshipHelperID() {
-        return (Integer)readProperty("relationshipHelperID");
+        beforePropertyRead("relationshipHelperID");
+        return relationshipHelperID;
     }
 
     public void setToRelationshipHelper(RelationshipHelper toRelationshipHelper) {
@@ -34,5 +45,60 @@ public abstract class _MeaningfulFK extends CayenneDataObject {
         return (RelationshipHelper)readProperty("toRelationshipHelper");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "relationshipHelperID":
+                return this.relationshipHelperID;
+            case "toRelationshipHelper":
+                return this.toRelationshipHelper;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "relationshipHelperID":
+                this.relationshipHelperID = (Integer)val;
+                break;
+            case "toRelationshipHelper":
+                this.toRelationshipHelper = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(relationshipHelperID);
+        out.writeObject(toRelationshipHelper);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        relationshipHelperID = (Integer)in.readObject();
+        toRelationshipHelper = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_ReflexiveAndToOne.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_ReflexiveAndToOne.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_ReflexiveAndToOne.java
index 1f180dd..3666855 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_ReflexiveAndToOne.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_ReflexiveAndToOne.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships.ReflexiveAndToOne;
 import org.apache.cayenne.testdo.relationships.RelationshipHelper;
@@ -13,7 +16,7 @@ import org.apache.cayenne.testdo.relationships.RelationshipHelper;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ReflexiveAndToOne extends CayenneDataObject {
+public abstract class _ReflexiveAndToOne extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -24,25 +27,35 @@ public abstract class _ReflexiveAndToOne extends CayenneDataObject {
     public static final Property<RelationshipHelper> TO_HELPER = Property.create("toHelper", RelationshipHelper.class);
     public static final Property<ReflexiveAndToOne> TO_PARENT = Property.create("toParent", ReflexiveAndToOne.class);
 
+    protected String name;
+
+    protected Object children;
+    protected Object toHelper;
+    protected Object toParent;
+
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void addToChildren(ReflexiveAndToOne obj) {
         addToManyTarget("children", obj, true);
     }
+
     public void removeFromChildren(ReflexiveAndToOne obj) {
         removeToManyTarget("children", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ReflexiveAndToOne> getChildren() {
         return (List<ReflexiveAndToOne>)readProperty("children");
     }
 
-
     public void setToHelper(RelationshipHelper toHelper) {
         setToOneTarget("toHelper", toHelper, true);
     }
@@ -51,7 +64,6 @@ public abstract class _ReflexiveAndToOne extends CayenneDataObject {
         return (RelationshipHelper)readProperty("toHelper");
     }
 
-
     public void setToParent(ReflexiveAndToOne toParent) {
         setToOneTarget("toParent", toParent, true);
     }
@@ -60,5 +72,74 @@ public abstract class _ReflexiveAndToOne extends CayenneDataObject {
         return (ReflexiveAndToOne)readProperty("toParent");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "children":
+                return this.children;
+            case "toHelper":
+                return this.toHelper;
+            case "toParent":
+                return this.toParent;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "name":
+                this.name = (String)val;
+                break;
+            case "children":
+                this.children = val;
+                break;
+            case "toHelper":
+                this.toHelper = val;
+                break;
+            case "toParent":
+                this.toParent = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(name);
+        out.writeObject(children);
+        out.writeObject(toHelper);
+        out.writeObject(toParent);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        children = in.readObject();
+        toHelper = in.readObject();
+        toParent = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_RelationshipHelper.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_RelationshipHelper.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_RelationshipHelper.java
index 86fd4e9..b36d04d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_RelationshipHelper.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships/auto/_RelationshipHelper.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships.FkOfDifferentType;
 import org.apache.cayenne.testdo.relationships.MeaningfulFK;
@@ -14,7 +17,7 @@ import org.apache.cayenne.testdo.relationships.ReflexiveAndToOne;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _RelationshipHelper extends CayenneDataObject {
+public abstract class _RelationshipHelper extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -25,47 +28,129 @@ public abstract class _RelationshipHelper extends CayenneDataObject {
     public static final Property<List<MeaningfulFK>> MEANIGFUL_FKS = Property.create("meanigfulFKs", List.class);
     public static final Property<List<ReflexiveAndToOne>> REFLEXIVE_AND_TO_ONE_ARRAY = Property.create("reflexiveAndToOneArray", List.class);
 
+    protected String name;
+
+    protected Object fksOfDifferentType;
+    protected Object meanigfulFKs;
+    protected Object reflexiveAndToOneArray;
+
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void addToFksOfDifferentType(FkOfDifferentType obj) {
         addToManyTarget("fksOfDifferentType", obj, true);
     }
+
     public void removeFromFksOfDifferentType(FkOfDifferentType obj) {
         removeToManyTarget("fksOfDifferentType", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FkOfDifferentType> getFksOfDifferentType() {
         return (List<FkOfDifferentType>)readProperty("fksOfDifferentType");
     }
 
-
     public void addToMeanigfulFKs(MeaningfulFK obj) {
         addToManyTarget("meanigfulFKs", obj, true);
     }
+
     public void removeFromMeanigfulFKs(MeaningfulFK obj) {
         removeToManyTarget("meanigfulFKs", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<MeaningfulFK> getMeanigfulFKs() {
         return (List<MeaningfulFK>)readProperty("meanigfulFKs");
     }
 
-
     public void addToReflexiveAndToOneArray(ReflexiveAndToOne obj) {
         addToManyTarget("reflexiveAndToOneArray", obj, true);
     }
+
     public void removeFromReflexiveAndToOneArray(ReflexiveAndToOne obj) {
         removeToManyTarget("reflexiveAndToOneArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ReflexiveAndToOne> getReflexiveAndToOneArray() {
         return (List<ReflexiveAndToOne>)readProperty("reflexiveAndToOneArray");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "fksOfDifferentType":
+                return this.fksOfDifferentType;
+            case "meanigfulFKs":
+                return this.meanigfulFKs;
+            case "reflexiveAndToOneArray":
+                return this.reflexiveAndToOneArray;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "name":
+                this.name = (String)val;
+                break;
+            case "fksOfDifferentType":
+                this.fksOfDifferentType = val;
+                break;
+            case "meanigfulFKs":
+                this.meanigfulFKs = val;
+                break;
+            case "reflexiveAndToOneArray":
+                this.reflexiveAndToOneArray = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(name);
+        out.writeObject(fksOfDifferentType);
+        out.writeObject(meanigfulFKs);
+        out.writeObject(reflexiveAndToOneArray);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        fksOfDifferentType = in.readObject();
+        meanigfulFKs = in.readObject();
+        reflexiveAndToOneArray = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_Activity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_Activity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_Activity.java
index 85beb7f..1dbdc84 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_Activity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_Activity.java
@@ -1,9 +1,12 @@
 package org.apache.cayenne.testdo.relationships_activity.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.sql.Date;
 import java.util.Map;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_activity.ActivityResult;
 
@@ -13,7 +16,7 @@ import org.apache.cayenne.testdo.relationships_activity.ActivityResult;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Activity extends CayenneDataObject {
+public abstract class _Activity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -23,31 +26,105 @@ public abstract class _Activity extends CayenneDataObject {
     public static final Property<Integer> APPOINTMENT_NO = Property.create("appointmentNo", Integer.class);
     public static final Property<Map<String, ActivityResult>> RESULTS = Property.create("results", Map.class);
 
+    protected Date appointmentDate;
+    protected int appointmentNo;
+
+    protected Object results;
+
     public void setAppointmentDate(Date appointmentDate) {
-        writeProperty("appointmentDate", appointmentDate);
+        beforePropertyWrite("appointmentDate", this.appointmentDate, appointmentDate);
+        this.appointmentDate = appointmentDate;
     }
+
     public Date getAppointmentDate() {
-        return (Date)readProperty("appointmentDate");
+        beforePropertyRead("appointmentDate");
+        return appointmentDate;
     }
 
     public void setAppointmentNo(int appointmentNo) {
-        writeProperty("appointmentNo", appointmentNo);
+        beforePropertyWrite("appointmentNo", this.appointmentNo, appointmentNo);
+        this.appointmentNo = appointmentNo;
     }
+
     public int getAppointmentNo() {
-        Object value = readProperty("appointmentNo");
-        return (value != null) ? (Integer) value : 0;
+        beforePropertyRead("appointmentNo");
+        return appointmentNo;
     }
 
     public void addToResults(ActivityResult obj) {
         addToManyTarget("results", obj, true);
     }
+
     public void removeFromResults(ActivityResult obj) {
         removeToManyTarget("results", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public Map<String, ActivityResult> getResults() {
         return (Map<String, ActivityResult>)readProperty("results");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "appointmentDate":
+                return this.appointmentDate;
+            case "appointmentNo":
+                return this.appointmentNo;
+            case "results":
+                return this.results;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "appointmentDate":
+                this.appointmentDate = (Date)val;
+                break;
+            case "appointmentNo":
+                this.appointmentNo = (Integer)val;
+                break;
+            case "results":
+                this.results = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(appointmentDate);
+        out.writeInt(appointmentNo);
+        out.writeObject(results);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        appointmentDate = (Date)in.readObject();
+        appointmentNo = in.readInt();
+        results = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_ActivityResult.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_ActivityResult.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_ActivityResult.java
index 5db7ad9..c713e8f 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_ActivityResult.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_activity/auto/_ActivityResult.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_activity.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.sql.Date;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 
 /**
@@ -11,7 +14,7 @@ import org.apache.cayenne.exp.Property;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ActivityResult extends CayenneDataObject {
+public abstract class _ActivityResult extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -23,26 +26,102 @@ public abstract class _ActivityResult extends CayenneDataObject {
     public static final Property<Integer> APPOINT_NO = Property.create("appointNo", Integer.class);
     public static final Property<String> FIELD = Property.create("field", String.class);
 
+    protected Date appointDate;
+    protected int appointNo;
+    protected String field;
+
+
     public void setAppointDate(Date appointDate) {
-        writeProperty("appointDate", appointDate);
+        beforePropertyWrite("appointDate", this.appointDate, appointDate);
+        this.appointDate = appointDate;
     }
+
     public Date getAppointDate() {
-        return (Date)readProperty("appointDate");
+        beforePropertyRead("appointDate");
+        return appointDate;
     }
 
     public void setAppointNo(int appointNo) {
-        writeProperty("appointNo", appointNo);
+        beforePropertyWrite("appointNo", this.appointNo, appointNo);
+        this.appointNo = appointNo;
     }
+
     public int getAppointNo() {
-        Object value = readProperty("appointNo");
-        return (value != null) ? (Integer) value : 0;
+        beforePropertyRead("appointNo");
+        return appointNo;
     }
 
     public void setField(String field) {
-        writeProperty("field", field);
+        beforePropertyWrite("field", this.field, field);
+        this.field = field;
     }
+
     public String getField() {
-        return (String)readProperty("field");
+        beforePropertyRead("field");
+        return field;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "appointDate":
+                return this.appointDate;
+            case "appointNo":
+                return this.appointNo;
+            case "field":
+                return this.field;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "appointDate":
+                this.appointDate = (Date)val;
+                break;
+            case "appointNo":
+                this.appointNo = (Integer)val;
+                break;
+            case "field":
+                this.field = (String)val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(appointDate);
+        out.writeInt(appointNo);
+        out.writeObject(field);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        appointDate = (Date)in.readObject();
+        appointNo = in.readInt();
+        field = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Child.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Child.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Child.java
index 2bfc434..6c0c80d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Child.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Child.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_child_master.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_child_master.Master;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_child_master.Master;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Child extends CayenneDataObject {
+public abstract class _Child extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _Child extends CayenneDataObject {
 
     public static final Property<Master> MASTER = Property.create("master", Master.class);
 
+
+    protected Object master;
+
     public void setMaster(Master master) {
         setToOneTarget("master", master, true);
     }
@@ -26,5 +33,53 @@ public abstract class _Child extends CayenneDataObject {
         return (Master)readProperty("master");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "master":
+                return this.master;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "master":
+                this.master = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(master);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        master = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Master.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Master.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Master.java
index 387846c..fb90e0b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Master.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_child_master/auto/_Master.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_child_master.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_child_master.Child;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_child_master.Child;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Master extends CayenneDataObject {
+public abstract class _Master extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -21,23 +24,87 @@ public abstract class _Master extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<Child>> CHILDREN = Property.create("children", List.class);
 
+    protected String name;
+
+    protected Object children;
+
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void addToChildren(Child obj) {
         addToManyTarget("children", obj, true);
     }
+
     public void removeFromChildren(Child obj) {
         removeToManyTarget("children", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Child> getChildren() {
         return (List<Child>)readProperty("children");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "children":
+                return this.children;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "name":
+                this.name = (String)val;
+                break;
+            case "children":
+                this.children = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(name);
+        out.writeObject(children);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        children = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobDetail.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobDetail.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobDetail.java
index 59420b4..3f455bb 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobDetail.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobDetail.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_clob.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_clob.ClobMaster;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_clob.ClobMaster;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ClobDetail extends CayenneDataObject {
+public abstract class _ClobDetail extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +23,18 @@ public abstract class _ClobDetail extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<ClobMaster> MASTER = Property.create("master", ClobMaster.class);
 
+    protected String name;
+
+    protected Object master;
+
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void setMaster(ClobMaster master) {
@@ -34,5 +45,60 @@ public abstract class _ClobDetail extends CayenneDataObject {
         return (ClobMaster)readProperty("master");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "master":
+                return this.master;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "name":
+                this.name = (String)val;
+                break;
+            case "master":
+                this.master = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(name);
+        out.writeObject(master);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        master = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobMaster.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobMaster.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobMaster.java
index da9527a..d88ad8f 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobMaster.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_clob/auto/_ClobMaster.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_clob.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_clob.ClobDetail;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_clob.ClobDetail;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ClobMaster extends CayenneDataObject {
+public abstract class _ClobMaster extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,30 +25,105 @@ public abstract class _ClobMaster extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<ClobDetail>> DETAILS = Property.create("details", List.class);
 
+    protected String clobColumn;
+    protected String name;
+
+    protected Object details;
+
     public void setClobColumn(String clobColumn) {
-        writeProperty("clobColumn", clobColumn);
+        beforePropertyWrite("clobColumn", this.clobColumn, clobColumn);
+        this.clobColumn = clobColumn;
     }
+
     public String getClobColumn() {
-        return (String)readProperty("clobColumn");
+        beforePropertyRead("clobColumn");
+        return clobColumn;
     }
 
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
     public void addToDetails(ClobDetail obj) {
         addToManyTarget("details", obj, true);
     }
+
     public void removeFromDetails(ClobDetail obj) {
         removeToManyTarget("details", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ClobDetail> getDetails() {
         return (List<ClobDetail>)readProperty("details");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "clobColumn":
+                return this.clobColumn;
+            case "name":
+                return this.name;
+            case "details":
+                return this.details;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "clobColumn":
+                this.clobColumn = (String)val;
+                break;
+            case "name":
+                this.name = (String)val;
+                break;
+            case "details":
+                this.details = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(clobColumn);
+        out.writeObject(name);
+        out.writeObject(details);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        clobColumn = (String)in.readObject();
+        name = (String)in.readObject();
+        details = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToMany.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToMany.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToMany.java
index 4a3a328..c771d5e 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToMany.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToMany.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_collection_to_many.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Collection;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_collection_to_many.CollectionToManyTarget;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_collection_to_many.CollectionToMa
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _CollectionToMany extends CayenneDataObject {
+public abstract class _CollectionToMany extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,16 +23,69 @@ public abstract class _CollectionToMany extends CayenneDataObject {
 
     public static final Property<Collection<CollectionToManyTarget>> TARGETS = Property.create("targets", Collection.class);
 
+
+    protected Object targets;
+
     public void addToTargets(CollectionToManyTarget obj) {
         addToManyTarget("targets", obj, true);
     }
+
     public void removeFromTargets(CollectionToManyTarget obj) {
         removeToManyTarget("targets", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public Collection<CollectionToManyTarget> getTargets() {
         return (Collection<CollectionToManyTarget>)readProperty("targets");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "targets":
+                return this.targets;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "targets":
+                this.targets = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(targets);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        targets = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToManyTarget.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToManyTarget.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToManyTarget.java
index 4bb3632..6ed5354 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToManyTarget.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_collection_to_many/auto/_CollectionToManyTarget.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_collection_to_many.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_collection_to_many.CollectionToMany;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_collection_to_many.CollectionToMa
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _CollectionToManyTarget extends CayenneDataObject {
+public abstract class _CollectionToManyTarget extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _CollectionToManyTarget extends CayenneDataObject {
 
     public static final Property<CollectionToMany> COLLECTION_TO_MANY = Property.create("collectionToMany", CollectionToMany.class);
 
+
+    protected Object collectionToMany;
+
     public void setCollectionToMany(CollectionToMany collectionToMany) {
         setToOneTarget("collectionToMany", collectionToMany, true);
     }
@@ -26,5 +33,53 @@ public abstract class _CollectionToManyTarget extends CayenneDataObject {
         return (CollectionToMany)readProperty("collectionToMany");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "collectionToMany":
+                return this.collectionToMany;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "collectionToMany":
+                this.collectionToMany = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(collectionToMany);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        collectionToMany = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatA.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatA.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatA.java
index 76f1e74..c9d5139 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatA.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatA.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_delete_rules.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleFlatB;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleFlatB;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _DeleteRuleFlatA extends CayenneDataObject {
+public abstract class _DeleteRuleFlatA extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,16 +23,69 @@ public abstract class _DeleteRuleFlatA extends CayenneDataObject {
 
     public static final Property<List<DeleteRuleFlatB>> FLAT_B = Property.create("flatB", List.class);
 
+
+    protected Object flatB;
+
     public void addToFlatB(DeleteRuleFlatB obj) {
         addToManyTarget("flatB", obj, true);
     }
+
     public void removeFromFlatB(DeleteRuleFlatB obj) {
         removeToManyTarget("flatB", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<DeleteRuleFlatB> getFlatB() {
         return (List<DeleteRuleFlatB>)readProperty("flatB");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "flatB":
+                return this.flatB;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "flatB":
+                this.flatB = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(flatB);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        flatB = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatB.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatB.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatB.java
index 2c1cc1b..da50775 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatB.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleFlatB.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_delete_rules.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleFlatA;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleFlatA;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _DeleteRuleFlatB extends CayenneDataObject {
+public abstract class _DeleteRuleFlatB extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,16 +23,69 @@ public abstract class _DeleteRuleFlatB extends CayenneDataObject {
 
     public static final Property<List<DeleteRuleFlatA>> UNTITLED_REL = Property.create("untitledRel", List.class);
 
+
+    protected Object untitledRel;
+
     public void addToUntitledRel(DeleteRuleFlatA obj) {
         addToManyTarget("untitledRel", obj, true);
     }
+
     public void removeFromUntitledRel(DeleteRuleFlatA obj) {
         removeToManyTarget("untitledRel", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<DeleteRuleFlatA> getUntitledRel() {
         return (List<DeleteRuleFlatA>)readProperty("untitledRel");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "untitledRel":
+                return this.untitledRel;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "untitledRel":
+                this.untitledRel = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(untitledRel);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        untitledRel = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest1.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest1.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest1.java
index e5cec94..6bd477f 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest1.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest1.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_delete_rules.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleTest2;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleTest2;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _DeleteRuleTest1 extends CayenneDataObject {
+public abstract class _DeleteRuleTest1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _DeleteRuleTest1 extends CayenneDataObject {
 
     public static final Property<DeleteRuleTest2> TEST2 = Property.create("test2", DeleteRuleTest2.class);
 
+
+    protected Object test2;
+
     public void setTest2(DeleteRuleTest2 test2) {
         setToOneTarget("test2", test2, true);
     }
@@ -26,5 +33,53 @@ public abstract class _DeleteRuleTest1 extends CayenneDataObject {
         return (DeleteRuleTest2)readProperty("test2");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "test2":
+                return this.test2;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "test2":
+                this.test2 = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(test2);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        test2 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest2.java
index c12d858..1a88c8e 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest2.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_delete_rules.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleTest1;
 import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleTest3;
@@ -13,7 +16,7 @@ import org.apache.cayenne.testdo.relationships_delete_rules.DeleteRuleTest3;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _DeleteRuleTest2 extends CayenneDataObject {
+public abstract class _DeleteRuleTest2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,28 +25,90 @@ public abstract class _DeleteRuleTest2 extends CayenneDataObject {
     public static final Property<List<DeleteRuleTest3>> DELETE_RULE_TEST3ARRAY = Property.create("deleteRuleTest3Array", List.class);
     public static final Property<List<DeleteRuleTest1>> TEST1ARRAY = Property.create("test1Array", List.class);
 
+
+    protected Object deleteRuleTest3Array;
+    protected Object test1Array;
+
     public void addToDeleteRuleTest3Array(DeleteRuleTest3 obj) {
         addToManyTarget("deleteRuleTest3Array", obj, true);
     }
+
     public void removeFromDeleteRuleTest3Array(DeleteRuleTest3 obj) {
         removeToManyTarget("deleteRuleTest3Array", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<DeleteRuleTest3> getDeleteRuleTest3Array() {
         return (List<DeleteRuleTest3>)readProperty("deleteRuleTest3Array");
     }
 
-
     public void addToTest1Array(DeleteRuleTest1 obj) {
         addToManyTarget("test1Array", obj, true);
     }
+
     public void removeFromTest1Array(DeleteRuleTest1 obj) {
         removeToManyTarget("test1Array", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<DeleteRuleTest1> getTest1Array() {
         return (List<DeleteRuleTest1>)readProperty("test1Array");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "deleteRuleTest3Array":
+                return this.deleteRuleTest3Array;
+            case "test1Array":
+                return this.test1Array;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "deleteRuleTest3Array":
+                this.deleteRuleTest3Array = val;
+                break;
+            case "test1Array":
+                this.test1Array = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(deleteRuleTest3Array);
+        out.writeObject(test1Array);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        deleteRuleTest3Array = in.readObject();
+        test1Array = in.readObject();
+    }
 
 }


Mime
View raw message