cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [03/18] cayenne git commit: CAY-2330 Field based data objects
Date Fri, 11 Aug 2017 07:54:40 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest3.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest3.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest3.java
index 6f7d250..a908ca4 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest3.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_delete_rules/auto/_DeleteRuleTest3.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 _DeleteRuleTest3 extends CayenneDataObject {
+public abstract class _DeleteRuleTest3 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _DeleteRuleTest3 extends CayenneDataObject {
 
     public static final Property<DeleteRuleTest2> TO_DELETE_RULE_TEST2 = Property.create("toDeleteRuleTest2", DeleteRuleTest2.class);
 
+
+    protected Object toDeleteRuleTest2;
+
     public void setToDeleteRuleTest2(DeleteRuleTest2 toDeleteRuleTest2) {
         setToOneTarget("toDeleteRuleTest2", toDeleteRuleTest2, true);
     }
@@ -26,5 +33,53 @@ public abstract class _DeleteRuleTest3 extends CayenneDataObject {
         return (DeleteRuleTest2)readProperty("toDeleteRuleTest2");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "toDeleteRuleTest2":
+                return this.toDeleteRuleTest2;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "toDeleteRuleTest2":
+                this.toDeleteRuleTest2 = 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(toDeleteRuleTest2);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        toDeleteRuleTest2 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedCircular.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedCircular.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedCircular.java
index 7406905..23b387e 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedCircular.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedCircular.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_flattened.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_flattened.FlattenedCircular;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_flattened.FlattenedCircular;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _FlattenedCircular extends CayenneDataObject {
+public abstract class _FlattenedCircular extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -21,28 +24,90 @@ public abstract class _FlattenedCircular extends CayenneDataObject {
     public static final Property<List<FlattenedCircular>> SIDE1S = Property.create("side1s", List.class);
     public static final Property<List<FlattenedCircular>> SIDE2S = Property.create("side2s", List.class);
 
+
+    protected Object side1s;
+    protected Object side2s;
+
     public void addToSide1s(FlattenedCircular obj) {
         addToManyTarget("side1s", obj, true);
     }
+
     public void removeFromSide1s(FlattenedCircular obj) {
         removeToManyTarget("side1s", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FlattenedCircular> getSide1s() {
         return (List<FlattenedCircular>)readProperty("side1s");
     }
 
-
     public void addToSide2s(FlattenedCircular obj) {
         addToManyTarget("side2s", obj, true);
     }
+
     public void removeFromSide2s(FlattenedCircular obj) {
         removeToManyTarget("side2s", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FlattenedCircular> getSide2s() {
         return (List<FlattenedCircular>)readProperty("side2s");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "side1s":
+                return this.side1s;
+            case "side2s":
+                return this.side2s;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "side1s":
+                this.side1s = val;
+                break;
+            case "side2s":
+                this.side2s = 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(side1s);
+        out.writeObject(side2s);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        side1s = in.readObject();
+        side2s = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest1.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest1.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest1.java
index a215d50..a60aff7 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest1.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest1.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_flattened.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_flattened.FlattenedTest2;
 import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest3;
@@ -15,7 +18,7 @@ import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest5;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _FlattenedTest1 extends CayenneDataObject {
+public abstract class _FlattenedTest1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -28,59 +31,155 @@ public abstract class _FlattenedTest1 extends CayenneDataObject {
     public static final Property<List<FlattenedTest4>> FT4ARRAY_FOR1 = Property.create("ft4ArrayFor1", List.class);
     public static final Property<List<FlattenedTest5>> FT5ARRAY = Property.create("ft5Array", List.class);
 
+    protected String name;
+
+    protected Object ft2Array;
+    protected Object ft3Array;
+    protected Object ft3OverComplex;
+    protected Object ft4ArrayFor1;
+    protected Object ft5Array;
+
     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 addToFt2Array(FlattenedTest2 obj) {
         addToManyTarget("ft2Array", obj, true);
     }
+
     public void removeFromFt2Array(FlattenedTest2 obj) {
         removeToManyTarget("ft2Array", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FlattenedTest2> getFt2Array() {
         return (List<FlattenedTest2>)readProperty("ft2Array");
     }
 
-
     @SuppressWarnings("unchecked")
     public List<FlattenedTest3> getFt3Array() {
         return (List<FlattenedTest3>)readProperty("ft3Array");
     }
 
-
     public void addToFt3OverComplex(FlattenedTest3 obj) {
         addToManyTarget("ft3OverComplex", obj, true);
     }
+
     public void removeFromFt3OverComplex(FlattenedTest3 obj) {
         removeToManyTarget("ft3OverComplex", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FlattenedTest3> getFt3OverComplex() {
         return (List<FlattenedTest3>)readProperty("ft3OverComplex");
     }
 
-
     @SuppressWarnings("unchecked")
     public List<FlattenedTest4> getFt4ArrayFor1() {
         return (List<FlattenedTest4>)readProperty("ft4ArrayFor1");
     }
 
-
     public void addToFt5Array(FlattenedTest5 obj) {
         addToManyTarget("ft5Array", obj, true);
     }
+
     public void removeFromFt5Array(FlattenedTest5 obj) {
         removeToManyTarget("ft5Array", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FlattenedTest5> getFt5Array() {
         return (List<FlattenedTest5>)readProperty("ft5Array");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "ft2Array":
+                return this.ft2Array;
+            case "ft3Array":
+                return this.ft3Array;
+            case "ft3OverComplex":
+                return this.ft3OverComplex;
+            case "ft4ArrayFor1":
+                return this.ft4ArrayFor1;
+            case "ft5Array":
+                return this.ft5Array;
+            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 "ft2Array":
+                this.ft2Array = val;
+                break;
+            case "ft3Array":
+                this.ft3Array = val;
+                break;
+            case "ft3OverComplex":
+                this.ft3OverComplex = val;
+                break;
+            case "ft4ArrayFor1":
+                this.ft4ArrayFor1 = val;
+                break;
+            case "ft5Array":
+                this.ft5Array = 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(ft2Array);
+        out.writeObject(ft3Array);
+        out.writeObject(ft3OverComplex);
+        out.writeObject(ft4ArrayFor1);
+        out.writeObject(ft5Array);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        ft2Array = in.readObject();
+        ft3Array = in.readObject();
+        ft3OverComplex = in.readObject();
+        ft4ArrayFor1 = in.readObject();
+        ft5Array = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest2.java
index d2fdb0b..5cee2ab 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest2.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_flattened.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_flattened.FlattenedTest1;
 import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest3;
@@ -13,7 +16,7 @@ import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest3;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _FlattenedTest2 extends CayenneDataObject {
+public abstract class _FlattenedTest2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -23,25 +26,34 @@ public abstract class _FlattenedTest2 extends CayenneDataObject {
     public static final Property<List<FlattenedTest3>> FT3ARRAY = Property.create("ft3Array", List.class);
     public static final Property<FlattenedTest1> TO_FT1 = Property.create("toFT1", FlattenedTest1.class);
 
+    protected String name;
+
+    protected Object ft3Array;
+    protected Object toFT1;
+
     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 addToFt3Array(FlattenedTest3 obj) {
         addToManyTarget("ft3Array", obj, true);
     }
+
     public void removeFromFt3Array(FlattenedTest3 obj) {
         removeToManyTarget("ft3Array", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FlattenedTest3> getFt3Array() {
         return (List<FlattenedTest3>)readProperty("ft3Array");
     }
 
-
     public void setToFT1(FlattenedTest1 toFT1) {
         setToOneTarget("toFT1", toFT1, true);
     }
@@ -50,5 +62,67 @@ public abstract class _FlattenedTest2 extends CayenneDataObject {
         return (FlattenedTest1)readProperty("toFT1");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "ft3Array":
+                return this.ft3Array;
+            case "toFT1":
+                return this.toFT1;
+            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 "ft3Array":
+                this.ft3Array = val;
+                break;
+            case "toFT1":
+                this.toFT1 = 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(ft3Array);
+        out.writeObject(toFT1);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        ft3Array = in.readObject();
+        toFT1 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest3.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest3.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest3.java
index d05da64..ce4fb5c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest3.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest3.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_flattened.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_flattened.FlattenedTest1;
 import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest2;
@@ -14,7 +17,7 @@ import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest4;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _FlattenedTest3 extends CayenneDataObject {
+public abstract class _FlattenedTest3 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -25,31 +28,39 @@ public abstract class _FlattenedTest3 extends CayenneDataObject {
     public static final Property<FlattenedTest1> TO_FT1 = Property.create("toFT1", FlattenedTest1.class);
     public static final Property<FlattenedTest2> TO_FT2 = Property.create("toFT2", FlattenedTest2.class);
 
+    protected String name;
+
+    protected Object ft4Array;
+    protected Object toFT1;
+    protected Object toFT2;
+
     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 addToFt4Array(FlattenedTest4 obj) {
         addToManyTarget("ft4Array", obj, true);
     }
+
     public void removeFromFt4Array(FlattenedTest4 obj) {
         removeToManyTarget("ft4Array", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<FlattenedTest4> getFt4Array() {
         return (List<FlattenedTest4>)readProperty("ft4Array");
     }
 
-
-
     public FlattenedTest1 getToFT1() {
         return (FlattenedTest1)readProperty("toFT1");
     }
 
-
     public void setToFT2(FlattenedTest2 toFT2) {
         setToOneTarget("toFT2", toFT2, true);
     }
@@ -58,5 +69,74 @@ public abstract class _FlattenedTest3 extends CayenneDataObject {
         return (FlattenedTest2)readProperty("toFT2");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "ft4Array":
+                return this.ft4Array;
+            case "toFT1":
+                return this.toFT1;
+            case "toFT2":
+                return this.toFT2;
+            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 "ft4Array":
+                this.ft4Array = val;
+                break;
+            case "toFT1":
+                this.toFT1 = val;
+                break;
+            case "toFT2":
+                this.toFT2 = 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(ft4Array);
+        out.writeObject(toFT1);
+        out.writeObject(toFT2);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        ft4Array = in.readObject();
+        toFT1 = in.readObject();
+        toFT2 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest4.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest4.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest4.java
index 55392e9..725f2b5 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest4.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest4.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_flattened.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_flattened.FlattenedTest3;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest3;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _FlattenedTest4 extends CayenneDataObject {
+public abstract class _FlattenedTest4 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +23,18 @@ public abstract class _FlattenedTest4 extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<FlattenedTest3> TO_FT3 = Property.create("toFT3", FlattenedTest3.class);
 
+    protected String name;
+
+    protected Object toFT3;
+
     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 setToFT3(FlattenedTest3 toFT3) {
@@ -34,5 +45,60 @@ public abstract class _FlattenedTest4 extends CayenneDataObject {
         return (FlattenedTest3)readProperty("toFT3");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "toFT3":
+                return this.toFT3;
+            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 "toFT3":
+                this.toFT3 = 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(toFT3);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        toFT3 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest5.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest5.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest5.java
index 3233a3d..e6112ab 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest5.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_flattened/auto/_FlattenedTest5.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_flattened.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_flattened.FlattenedTest1;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_flattened.FlattenedTest1;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _FlattenedTest5 extends CayenneDataObject {
+public abstract class _FlattenedTest5 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +23,18 @@ public abstract class _FlattenedTest5 extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<FlattenedTest1> TO_FT1 = Property.create("toFT1", FlattenedTest1.class);
 
+    protected String name;
+
+    protected Object toFT1;
+
     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 setToFT1(FlattenedTest1 toFT1) {
@@ -34,5 +45,60 @@ public abstract class _FlattenedTest5 extends CayenneDataObject {
         return (FlattenedTest1)readProperty("toFT1");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "toFT1":
+                return this.toFT1;
+            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 "toFT1":
+                this.toFT1 = 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(toFT1);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        toFT1 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToMany.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToMany.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToMany.java
index 5c4427f..07ba3e7 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToMany.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToMany.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_set_to_many.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Set;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.relationships_set_to_many.SetToManyTarget;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_set_to_many.SetToManyTarget;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _SetToMany extends CayenneDataObject {
+public abstract class _SetToMany extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,16 +23,69 @@ public abstract class _SetToMany extends CayenneDataObject {
 
     public static final Property<Set<SetToManyTarget>> TARGETS = Property.create("targets", Set.class);
 
+
+    protected Object targets;
+
     public void addToTargets(SetToManyTarget obj) {
         addToManyTarget("targets", obj, true);
     }
+
     public void removeFromTargets(SetToManyTarget obj) {
         removeToManyTarget("targets", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public Set<SetToManyTarget> getTargets() {
         return (Set<SetToManyTarget>)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_set_to_many/auto/_SetToManyTarget.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToManyTarget.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToManyTarget.java
index d2edc6c..dd0d5ca 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToManyTarget.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_set_to_many/auto/_SetToManyTarget.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_set_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_set_to_many.SetToMany;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_set_to_many.SetToMany;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _SetToManyTarget extends CayenneDataObject {
+public abstract class _SetToManyTarget extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _SetToManyTarget extends CayenneDataObject {
 
     public static final Property<SetToMany> SET_TO_MANY = Property.create("setToMany", SetToMany.class);
 
+
+    protected Object setToMany;
+
     public void setSetToMany(SetToMany setToMany) {
         setToOneTarget("setToMany", setToMany, true);
     }
@@ -26,5 +33,53 @@ public abstract class _SetToManyTarget extends CayenneDataObject {
         return (SetToMany)readProperty("setToMany");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "setToMany":
+                return this.setToMany;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "setToMany":
+                this.setToMany = 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(setToMany);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        setToMany = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkDep.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkDep.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkDep.java
index 5aa0b67..25c3d34 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkDep.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkDep.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_to_many_fk.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_to_many_fk.ToManyFkRoot;
 import org.apache.cayenne.testdo.relationships_to_many_fk.ToManyRoot2;
@@ -11,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_to_many_fk.ToManyRoot2;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ToManyFkDep extends CayenneDataObject {
+public abstract class _ToManyFkDep extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -23,18 +27,30 @@ public abstract class _ToManyFkDep extends CayenneDataObject {
     public static final Property<ToManyFkRoot> ROOT = Property.create("root", ToManyFkRoot.class);
     public static final Property<ToManyRoot2> ROOT2 = Property.create("root2", ToManyRoot2.class);
 
+    protected Integer depId;
+    protected String name;
+
+    protected Object root;
+    protected Object root2;
+
     public void setDepId(Integer depId) {
-        writeProperty("depId", depId);
+        beforePropertyWrite("depId", this.depId, depId);
+        this.depId = depId;
     }
+
     public Integer getDepId() {
-        return (Integer)readProperty("depId");
+        beforePropertyRead("depId");
+        return depId;
     }
 
     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 setRoot(ToManyFkRoot root) {
@@ -45,7 +61,6 @@ public abstract class _ToManyFkDep extends CayenneDataObject {
         return (ToManyFkRoot)readProperty("root");
     }
 
-
     public void setRoot2(ToManyRoot2 root2) {
         setToOneTarget("root2", root2, true);
     }
@@ -54,5 +69,74 @@ public abstract class _ToManyFkDep extends CayenneDataObject {
         return (ToManyRoot2)readProperty("root2");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "depId":
+                return this.depId;
+            case "name":
+                return this.name;
+            case "root":
+                return this.root;
+            case "root2":
+                return this.root2;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "depId":
+                this.depId = (Integer)val;
+                break;
+            case "name":
+                this.name = (String)val;
+                break;
+            case "root":
+                this.root = val;
+                break;
+            case "root2":
+                this.root2 = 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(depId);
+        out.writeObject(name);
+        out.writeObject(root);
+        out.writeObject(root2);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        depId = (Integer)in.readObject();
+        name = (String)in.readObject();
+        root = in.readObject();
+        root2 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkRoot.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkRoot.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkRoot.java
index 98a159f..496de77 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkRoot.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyFkRoot.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_to_many_fk.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_to_many_fk.ToManyFkDep;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_to_many_fk.ToManyFkDep;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ToManyFkRoot extends CayenneDataObject {
+public abstract class _ToManyFkRoot extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,30 +25,105 @@ public abstract class _ToManyFkRoot extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<ToManyFkDep>> DEPS = Property.create("deps", List.class);
 
+    protected Integer depId;
+    protected String name;
+
+    protected Object deps;
+
     public void setDepId(Integer depId) {
-        writeProperty("depId", depId);
+        beforePropertyWrite("depId", this.depId, depId);
+        this.depId = depId;
     }
+
     public Integer getDepId() {
-        return (Integer)readProperty("depId");
+        beforePropertyRead("depId");
+        return depId;
     }
 
     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 addToDeps(ToManyFkDep obj) {
         addToManyTarget("deps", obj, true);
     }
+
     public void removeFromDeps(ToManyFkDep obj) {
         removeToManyTarget("deps", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ToManyFkDep> getDeps() {
         return (List<ToManyFkDep>)readProperty("deps");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "depId":
+                return this.depId;
+            case "name":
+                return this.name;
+            case "deps":
+                return this.deps;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "depId":
+                this.depId = (Integer)val;
+                break;
+            case "name":
+                this.name = (String)val;
+                break;
+            case "deps":
+                this.deps = 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(depId);
+        out.writeObject(name);
+        out.writeObject(deps);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        depId = (Integer)in.readObject();
+        name = (String)in.readObject();
+        deps = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyRoot2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyRoot2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyRoot2.java
index 51d53fc..27bebd2 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyRoot2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_many_fk/auto/_ToManyRoot2.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.relationships_to_many_fk.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_to_many_fk.ToManyFkDep;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.relationships_to_many_fk.ToManyFkDep;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ToManyRoot2 extends CayenneDataObject {
+public abstract class _ToManyRoot2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -21,23 +24,87 @@ public abstract class _ToManyRoot2 extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<ToManyFkDep>> DEPS = Property.create("deps", List.class);
 
+    protected String name;
+
+    protected Object deps;
+
     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 addToDeps(ToManyFkDep obj) {
         addToManyTarget("deps", obj, true);
     }
+
     public void removeFromDeps(ToManyFkDep obj) {
         removeToManyTarget("deps", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ToManyFkDep> getDeps() {
         return (List<ToManyFkDep>)readProperty("deps");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "deps":
+                return this.deps;
+            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 "deps":
+                this.deps = 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(deps);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        deps = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK1.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK1.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK1.java
index 2a018ca..3e911ce 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK1.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK1.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_to_one_fk.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_to_one_fk.ToOneFK2;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_to_one_fk.ToOneFK2;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ToOneFK1 extends CayenneDataObject {
+public abstract class _ToOneFK1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _ToOneFK1 extends CayenneDataObject {
 
     public static final Property<ToOneFK2> TO_PK = Property.create("toPK", ToOneFK2.class);
 
+
+    protected Object toPK;
+
     public void setToPK(ToOneFK2 toPK) {
         setToOneTarget("toPK", toPK, true);
     }
@@ -26,5 +33,53 @@ public abstract class _ToOneFK1 extends CayenneDataObject {
         return (ToOneFK2)readProperty("toPK");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "toPK":
+                return this.toPK;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "toPK":
+                this.toPK = 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(toPK);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        toPK = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK2.java
index 92c6415..1ae24c7 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/relationships_to_one_fk/auto/_ToOneFK2.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.relationships_to_one_fk.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_to_one_fk.ToOneFK1;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.relationships_to_one_fk.ToOneFK1;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ToOneFK2 extends CayenneDataObject {
+public abstract class _ToOneFK2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,6 +22,9 @@ public abstract class _ToOneFK2 extends CayenneDataObject {
 
     public static final Property<ToOneFK1> TO_ONE_TO_FK = Property.create("toOneToFK", ToOneFK1.class);
 
+
+    protected Object toOneToFK;
+
     public void setToOneToFK(ToOneFK1 toOneToFK) {
         setToOneTarget("toOneToFK", toOneToFK, true);
     }
@@ -26,5 +33,53 @@ public abstract class _ToOneFK2 extends CayenneDataObject {
         return (ToOneFK1)readProperty("toOneToFK");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "toOneToFK":
+                return this.toOneToFK;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "toOneToFK":
+                this.toOneToFK = 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(toOneToFK);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        toOneToFK = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap1.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap1.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap1.java
index e30256f..fc1de31 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap1.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap1.java
@@ -1,5 +1,8 @@
 package org.apache.cayenne.testdo.return_types.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -39,144 +42,408 @@ public abstract class _ReturnTypesMap1 extends CayenneDataObject {
     public static final Property<Byte> TINYINT_COLUMN = Property.create("tinyintColumn", Byte.class);
     public static final Property<String> VARCHAR_COLUMN = Property.create("varcharColumn", String.class);
 
+    protected Long bigintColumn;
+    protected Boolean bitColumn;
+    protected Boolean booleanColumn;
+    protected String charColumn;
+    protected Date dateColumn;
+    protected BigDecimal decimalColumn;
+    protected Double doubleColumn;
+    protected Float floatColumn;
+    protected Integer integerColumn;
+    protected String longnvarcharColumn;
+    protected String longvarcharColumn;
+    protected String ncharColumn;
+    protected BigDecimal numericColumn;
+    protected String nvarcharColumn;
+    protected Float realColumn;
+    protected Short smallintColumn;
+    protected Date timeColumn;
+    protected Date timestampColumn;
+    protected Byte tinyintColumn;
+    protected String varcharColumn;
+
+
     public void setBigintColumn(Long bigintColumn) {
-        writeProperty("bigintColumn", bigintColumn);
+        beforePropertyWrite("bigintColumn", this.bigintColumn, bigintColumn);
+        this.bigintColumn = bigintColumn;
     }
+
     public Long getBigintColumn() {
-        return (Long)readProperty("bigintColumn");
+        beforePropertyRead("bigintColumn");
+        return bigintColumn;
     }
 
     public void setBitColumn(Boolean bitColumn) {
-        writeProperty("bitColumn", bitColumn);
+        beforePropertyWrite("bitColumn", this.bitColumn, bitColumn);
+        this.bitColumn = bitColumn;
     }
+
     public Boolean getBitColumn() {
-        return (Boolean)readProperty("bitColumn");
+        beforePropertyRead("bitColumn");
+        return bitColumn;
     }
 
     public void setBooleanColumn(Boolean booleanColumn) {
-        writeProperty("booleanColumn", booleanColumn);
+        beforePropertyWrite("booleanColumn", this.booleanColumn, booleanColumn);
+        this.booleanColumn = booleanColumn;
     }
+
     public Boolean getBooleanColumn() {
-        return (Boolean)readProperty("booleanColumn");
+        beforePropertyRead("booleanColumn");
+        return booleanColumn;
     }
 
     public void setCharColumn(String charColumn) {
-        writeProperty("charColumn", charColumn);
+        beforePropertyWrite("charColumn", this.charColumn, charColumn);
+        this.charColumn = charColumn;
     }
+
     public String getCharColumn() {
-        return (String)readProperty("charColumn");
+        beforePropertyRead("charColumn");
+        return charColumn;
     }
 
     public void setDateColumn(Date dateColumn) {
-        writeProperty("dateColumn", dateColumn);
+        beforePropertyWrite("dateColumn", this.dateColumn, dateColumn);
+        this.dateColumn = dateColumn;
     }
+
     public Date getDateColumn() {
-        return (Date)readProperty("dateColumn");
+        beforePropertyRead("dateColumn");
+        return dateColumn;
     }
 
     public void setDecimalColumn(BigDecimal decimalColumn) {
-        writeProperty("decimalColumn", decimalColumn);
+        beforePropertyWrite("decimalColumn", this.decimalColumn, decimalColumn);
+        this.decimalColumn = decimalColumn;
     }
+
     public BigDecimal getDecimalColumn() {
-        return (BigDecimal)readProperty("decimalColumn");
+        beforePropertyRead("decimalColumn");
+        return decimalColumn;
     }
 
     public void setDoubleColumn(Double doubleColumn) {
-        writeProperty("doubleColumn", doubleColumn);
+        beforePropertyWrite("doubleColumn", this.doubleColumn, doubleColumn);
+        this.doubleColumn = doubleColumn;
     }
+
     public Double getDoubleColumn() {
-        return (Double)readProperty("doubleColumn");
+        beforePropertyRead("doubleColumn");
+        return doubleColumn;
     }
 
     public void setFloatColumn(Float floatColumn) {
-        writeProperty("floatColumn", floatColumn);
+        beforePropertyWrite("floatColumn", this.floatColumn, floatColumn);
+        this.floatColumn = floatColumn;
     }
+
     public Float getFloatColumn() {
-        return (Float)readProperty("floatColumn");
+        beforePropertyRead("floatColumn");
+        return floatColumn;
     }
 
     public void setIntegerColumn(Integer integerColumn) {
-        writeProperty("integerColumn", integerColumn);
+        beforePropertyWrite("integerColumn", this.integerColumn, integerColumn);
+        this.integerColumn = integerColumn;
     }
+
     public Integer getIntegerColumn() {
-        return (Integer)readProperty("integerColumn");
+        beforePropertyRead("integerColumn");
+        return integerColumn;
     }
 
     public void setLongnvarcharColumn(String longnvarcharColumn) {
-        writeProperty("longnvarcharColumn", longnvarcharColumn);
+        beforePropertyWrite("longnvarcharColumn", this.longnvarcharColumn, longnvarcharColumn);
+        this.longnvarcharColumn = longnvarcharColumn;
     }
+
     public String getLongnvarcharColumn() {
-        return (String)readProperty("longnvarcharColumn");
+        beforePropertyRead("longnvarcharColumn");
+        return longnvarcharColumn;
     }
 
     public void setLongvarcharColumn(String longvarcharColumn) {
-        writeProperty("longvarcharColumn", longvarcharColumn);
+        beforePropertyWrite("longvarcharColumn", this.longvarcharColumn, longvarcharColumn);
+        this.longvarcharColumn = longvarcharColumn;
     }
+
     public String getLongvarcharColumn() {
-        return (String)readProperty("longvarcharColumn");
+        beforePropertyRead("longvarcharColumn");
+        return longvarcharColumn;
     }
 
     public void setNcharColumn(String ncharColumn) {
-        writeProperty("ncharColumn", ncharColumn);
+        beforePropertyWrite("ncharColumn", this.ncharColumn, ncharColumn);
+        this.ncharColumn = ncharColumn;
     }
+
     public String getNcharColumn() {
-        return (String)readProperty("ncharColumn");
+        beforePropertyRead("ncharColumn");
+        return ncharColumn;
     }
 
     public void setNumericColumn(BigDecimal numericColumn) {
-        writeProperty("numericColumn", numericColumn);
+        beforePropertyWrite("numericColumn", this.numericColumn, numericColumn);
+        this.numericColumn = numericColumn;
     }
+
     public BigDecimal getNumericColumn() {
-        return (BigDecimal)readProperty("numericColumn");
+        beforePropertyRead("numericColumn");
+        return numericColumn;
     }
 
     public void setNvarcharColumn(String nvarcharColumn) {
-        writeProperty("nvarcharColumn", nvarcharColumn);
+        beforePropertyWrite("nvarcharColumn", this.nvarcharColumn, nvarcharColumn);
+        this.nvarcharColumn = nvarcharColumn;
     }
+
     public String getNvarcharColumn() {
-        return (String)readProperty("nvarcharColumn");
+        beforePropertyRead("nvarcharColumn");
+        return nvarcharColumn;
     }
 
     public void setRealColumn(Float realColumn) {
-        writeProperty("realColumn", realColumn);
+        beforePropertyWrite("realColumn", this.realColumn, realColumn);
+        this.realColumn = realColumn;
     }
+
     public Float getRealColumn() {
-        return (Float)readProperty("realColumn");
+        beforePropertyRead("realColumn");
+        return realColumn;
     }
 
     public void setSmallintColumn(Short smallintColumn) {
-        writeProperty("smallintColumn", smallintColumn);
+        beforePropertyWrite("smallintColumn", this.smallintColumn, smallintColumn);
+        this.smallintColumn = smallintColumn;
     }
+
     public Short getSmallintColumn() {
-        return (Short)readProperty("smallintColumn");
+        beforePropertyRead("smallintColumn");
+        return smallintColumn;
     }
 
     public void setTimeColumn(Date timeColumn) {
-        writeProperty("timeColumn", timeColumn);
+        beforePropertyWrite("timeColumn", this.timeColumn, timeColumn);
+        this.timeColumn = timeColumn;
     }
+
     public Date getTimeColumn() {
-        return (Date)readProperty("timeColumn");
+        beforePropertyRead("timeColumn");
+        return timeColumn;
     }
 
     public void setTimestampColumn(Date timestampColumn) {
-        writeProperty("timestampColumn", timestampColumn);
+        beforePropertyWrite("timestampColumn", this.timestampColumn, timestampColumn);
+        this.timestampColumn = timestampColumn;
     }
+
     public Date getTimestampColumn() {
-        return (Date)readProperty("timestampColumn");
+        beforePropertyRead("timestampColumn");
+        return timestampColumn;
     }
 
     public void setTinyintColumn(Byte tinyintColumn) {
-        writeProperty("tinyintColumn", tinyintColumn);
+        beforePropertyWrite("tinyintColumn", this.tinyintColumn, tinyintColumn);
+        this.tinyintColumn = tinyintColumn;
     }
+
     public Byte getTinyintColumn() {
-        return (Byte)readProperty("tinyintColumn");
+        beforePropertyRead("tinyintColumn");
+        return tinyintColumn;
     }
 
     public void setVarcharColumn(String varcharColumn) {
-        writeProperty("varcharColumn", varcharColumn);
+        beforePropertyWrite("varcharColumn", this.varcharColumn, varcharColumn);
+        this.varcharColumn = varcharColumn;
     }
+
     public String getVarcharColumn() {
-        return (String)readProperty("varcharColumn");
+        beforePropertyRead("varcharColumn");
+        return varcharColumn;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "bigintColumn":
+                return this.bigintColumn;
+            case "bitColumn":
+                return this.bitColumn;
+            case "booleanColumn":
+                return this.booleanColumn;
+            case "charColumn":
+                return this.charColumn;
+            case "dateColumn":
+                return this.dateColumn;
+            case "decimalColumn":
+                return this.decimalColumn;
+            case "doubleColumn":
+                return this.doubleColumn;
+            case "floatColumn":
+                return this.floatColumn;
+            case "integerColumn":
+                return this.integerColumn;
+            case "longnvarcharColumn":
+                return this.longnvarcharColumn;
+            case "longvarcharColumn":
+                return this.longvarcharColumn;
+            case "ncharColumn":
+                return this.ncharColumn;
+            case "numericColumn":
+                return this.numericColumn;
+            case "nvarcharColumn":
+                return this.nvarcharColumn;
+            case "realColumn":
+                return this.realColumn;
+            case "smallintColumn":
+                return this.smallintColumn;
+            case "timeColumn":
+                return this.timeColumn;
+            case "timestampColumn":
+                return this.timestampColumn;
+            case "tinyintColumn":
+                return this.tinyintColumn;
+            case "varcharColumn":
+                return this.varcharColumn;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "bigintColumn":
+                this.bigintColumn = (Long)val;
+                break;
+            case "bitColumn":
+                this.bitColumn = (Boolean)val;
+                break;
+            case "booleanColumn":
+                this.booleanColumn = (Boolean)val;
+                break;
+            case "charColumn":
+                this.charColumn = (String)val;
+                break;
+            case "dateColumn":
+                this.dateColumn = (Date)val;
+                break;
+            case "decimalColumn":
+                this.decimalColumn = (BigDecimal)val;
+                break;
+            case "doubleColumn":
+                this.doubleColumn = (Double)val;
+                break;
+            case "floatColumn":
+                this.floatColumn = (Float)val;
+                break;
+            case "integerColumn":
+                this.integerColumn = (Integer)val;
+                break;
+            case "longnvarcharColumn":
+                this.longnvarcharColumn = (String)val;
+                break;
+            case "longvarcharColumn":
+                this.longvarcharColumn = (String)val;
+                break;
+            case "ncharColumn":
+                this.ncharColumn = (String)val;
+                break;
+            case "numericColumn":
+                this.numericColumn = (BigDecimal)val;
+                break;
+            case "nvarcharColumn":
+                this.nvarcharColumn = (String)val;
+                break;
+            case "realColumn":
+                this.realColumn = (Float)val;
+                break;
+            case "smallintColumn":
+                this.smallintColumn = (Short)val;
+                break;
+            case "timeColumn":
+                this.timeColumn = (Date)val;
+                break;
+            case "timestampColumn":
+                this.timestampColumn = (Date)val;
+                break;
+            case "tinyintColumn":
+                this.tinyintColumn = (Byte)val;
+                break;
+            case "varcharColumn":
+                this.varcharColumn = (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(bigintColumn);
+        out.writeObject(bitColumn);
+        out.writeObject(booleanColumn);
+        out.writeObject(charColumn);
+        out.writeObject(dateColumn);
+        out.writeObject(decimalColumn);
+        out.writeObject(doubleColumn);
+        out.writeObject(floatColumn);
+        out.writeObject(integerColumn);
+        out.writeObject(longnvarcharColumn);
+        out.writeObject(longvarcharColumn);
+        out.writeObject(ncharColumn);
+        out.writeObject(numericColumn);
+        out.writeObject(nvarcharColumn);
+        out.writeObject(realColumn);
+        out.writeObject(smallintColumn);
+        out.writeObject(timeColumn);
+        out.writeObject(timestampColumn);
+        out.writeObject(tinyintColumn);
+        out.writeObject(varcharColumn);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        bigintColumn = (Long)in.readObject();
+        bitColumn = (Boolean)in.readObject();
+        booleanColumn = (Boolean)in.readObject();
+        charColumn = (String)in.readObject();
+        dateColumn = (Date)in.readObject();
+        decimalColumn = (BigDecimal)in.readObject();
+        doubleColumn = (Double)in.readObject();
+        floatColumn = (Float)in.readObject();
+        integerColumn = (Integer)in.readObject();
+        longnvarcharColumn = (String)in.readObject();
+        longvarcharColumn = (String)in.readObject();
+        ncharColumn = (String)in.readObject();
+        numericColumn = (BigDecimal)in.readObject();
+        nvarcharColumn = (String)in.readObject();
+        realColumn = (Float)in.readObject();
+        smallintColumn = (Short)in.readObject();
+        timeColumn = (Date)in.readObject();
+        timestampColumn = (Date)in.readObject();
+        tinyintColumn = (Byte)in.readObject();
+        varcharColumn = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap2.java
index c4b9d29..99d82d1 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMap2.java
@@ -1,5 +1,9 @@
 package org.apache.cayenne.testdo.return_types.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
 import org.apache.cayenne.CayenneDataObject;
 import org.apache.cayenne.exp.Property;
 
@@ -20,32 +24,120 @@ public abstract class _ReturnTypesMap2 extends CayenneDataObject {
     public static final Property<byte[]> LONGVARBINARY_COLUMN = Property.create("longvarbinaryColumn", byte[].class);
     public static final Property<byte[]> VARBINARY_COLUMN = Property.create("varbinaryColumn", byte[].class);
 
+    protected byte[] binaryColumn;
+    protected byte[] blobColumn;
+    protected byte[] longvarbinaryColumn;
+    protected byte[] varbinaryColumn;
+
+
     public void setBinaryColumn(byte[] binaryColumn) {
-        writeProperty("binaryColumn", binaryColumn);
+        beforePropertyWrite("binaryColumn", this.binaryColumn, binaryColumn);
+        this.binaryColumn = binaryColumn;
     }
+
     public byte[] getBinaryColumn() {
-        return (byte[])readProperty("binaryColumn");
+        beforePropertyRead("binaryColumn");
+        return binaryColumn;
     }
 
     public void setBlobColumn(byte[] blobColumn) {
-        writeProperty("blobColumn", blobColumn);
+        beforePropertyWrite("blobColumn", this.blobColumn, blobColumn);
+        this.blobColumn = blobColumn;
     }
+
     public byte[] getBlobColumn() {
-        return (byte[])readProperty("blobColumn");
+        beforePropertyRead("blobColumn");
+        return blobColumn;
     }
 
     public void setLongvarbinaryColumn(byte[] longvarbinaryColumn) {
-        writeProperty("longvarbinaryColumn", longvarbinaryColumn);
+        beforePropertyWrite("longvarbinaryColumn", this.longvarbinaryColumn, longvarbinaryColumn);
+        this.longvarbinaryColumn = longvarbinaryColumn;
     }
+
     public byte[] getLongvarbinaryColumn() {
-        return (byte[])readProperty("longvarbinaryColumn");
+        beforePropertyRead("longvarbinaryColumn");
+        return longvarbinaryColumn;
     }
 
     public void setVarbinaryColumn(byte[] varbinaryColumn) {
-        writeProperty("varbinaryColumn", varbinaryColumn);
+        beforePropertyWrite("varbinaryColumn", this.varbinaryColumn, varbinaryColumn);
+        this.varbinaryColumn = varbinaryColumn;
     }
+
     public byte[] getVarbinaryColumn() {
-        return (byte[])readProperty("varbinaryColumn");
+        beforePropertyRead("varbinaryColumn");
+        return varbinaryColumn;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "binaryColumn":
+                return this.binaryColumn;
+            case "blobColumn":
+                return this.blobColumn;
+            case "longvarbinaryColumn":
+                return this.longvarbinaryColumn;
+            case "varbinaryColumn":
+                return this.varbinaryColumn;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "binaryColumn":
+                this.binaryColumn = (byte[])val;
+                break;
+            case "blobColumn":
+                this.blobColumn = (byte[])val;
+                break;
+            case "longvarbinaryColumn":
+                this.longvarbinaryColumn = (byte[])val;
+                break;
+            case "varbinaryColumn":
+                this.varbinaryColumn = (byte[])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(binaryColumn);
+        out.writeObject(blobColumn);
+        out.writeObject(longvarbinaryColumn);
+        out.writeObject(varbinaryColumn);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        binaryColumn = (byte[])in.readObject();
+        blobColumn = (byte[])in.readObject();
+        longvarbinaryColumn = (byte[])in.readObject();
+        varbinaryColumn = (byte[])in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMapLobs1.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMapLobs1.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMapLobs1.java
index 33993bc..8bff54e 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMapLobs1.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/return_types/auto/_ReturnTypesMapLobs1.java
@@ -1,5 +1,9 @@
 package org.apache.cayenne.testdo.return_types.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
 import org.apache.cayenne.CayenneDataObject;
 import org.apache.cayenne.exp.Property;
 
@@ -18,18 +22,84 @@ public abstract class _ReturnTypesMapLobs1 extends CayenneDataObject {
     public static final Property<String> CLOB_COLUMN = Property.create("clobColumn", String.class);
     public static final Property<String> NCLOB_COLUMN = Property.create("nclobColumn", String.class);
 
+    protected String clobColumn;
+    protected String nclobColumn;
+
+
     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 setNclobColumn(String nclobColumn) {
-        writeProperty("nclobColumn", nclobColumn);
+        beforePropertyWrite("nclobColumn", this.nclobColumn, nclobColumn);
+        this.nclobColumn = nclobColumn;
     }
+
     public String getNclobColumn() {
-        return (String)readProperty("nclobColumn");
+        beforePropertyRead("nclobColumn");
+        return nclobColumn;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "clobColumn":
+                return this.clobColumn;
+            case "nclobColumn":
+                return this.nclobColumn;
+            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 "nclobColumn":
+                this.nclobColumn = (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(clobColumn);
+        out.writeObject(nclobColumn);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        clobColumn = (String)in.readObject();
+        nclobColumn = (String)in.readObject();
     }
 
 }


Mime
View raw message