cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [06/18] cayenne git commit: CAY-2330 Field based data objects
Date Fri, 11 Aug 2017 07:54:43 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub2.java
index bb22d47..199322b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub2.java
@@ -1,5 +1,9 @@
 package org.apache.cayenne.testdo.inheritance_vertical.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.inheritance_vertical.IvRoot;
 
@@ -18,18 +22,84 @@ public abstract class _IvSub2 extends IvRoot {
     public static final Property<String> SUB2ATTR = Property.create("sub2Attr", String.class);
     public static final Property<String> SUB2NAME = Property.create("sub2Name", String.class);
 
+    protected String sub2Attr;
+    protected String sub2Name;
+
+
     public void setSub2Attr(String sub2Attr) {
-        writeProperty("sub2Attr", sub2Attr);
+        beforePropertyWrite("sub2Attr", this.sub2Attr, sub2Attr);
+        this.sub2Attr = sub2Attr;
     }
+
     public String getSub2Attr() {
-        return (String)readProperty("sub2Attr");
+        beforePropertyRead("sub2Attr");
+        return sub2Attr;
     }
 
     public void setSub2Name(String sub2Name) {
-        writeProperty("sub2Name", sub2Name);
+        beforePropertyWrite("sub2Name", this.sub2Name, sub2Name);
+        this.sub2Name = sub2Name;
     }
+
     public String getSub2Name() {
-        return (String)readProperty("sub2Name");
+        beforePropertyRead("sub2Name");
+        return sub2Name;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "sub2Attr":
+                return this.sub2Attr;
+            case "sub2Name":
+                return this.sub2Name;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "sub2Attr":
+                this.sub2Attr = (String)val;
+                break;
+            case "sub2Name":
+                this.sub2Name = (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(sub2Attr);
+        out.writeObject(sub2Name);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        sub2Attr = (String)in.readObject();
+        sub2Name = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub3.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub3.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub3.java
index 9c90d5e..b9272c0 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub3.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/inheritance_vertical/auto/_IvSub3.java
@@ -1,5 +1,9 @@
 package org.apache.cayenne.testdo.inheritance_vertical.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.inheritance_vertical.IvRoot;
 
@@ -18,11 +22,61 @@ public abstract class _IvSub3 extends IvRoot {
     public static final Property<IvRoot> IV_ROOT = Property.create("ivRoot", IvRoot.class);
 
 
+    protected Object ivRoot;
+
     public IvRoot getIvRoot() {
         return (IvRoot)readProperty("ivRoot");
     }
 
+protected abstract void onPrePersist();
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "ivRoot":
+                return this.ivRoot;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "ivRoot":
+                this.ivRoot = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
 
-    protected abstract void onPrePersist();
+    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(ivRoot);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        ivRoot = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycle_callbacks_order/auto/_Lifecycle.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycle_callbacks_order/auto/_Lifecycle.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycle_callbacks_order/auto/_Lifecycle.java
index b949e46..cce1bae 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycle_callbacks_order/auto/_Lifecycle.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycle_callbacks_order/auto/_Lifecycle.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.lifecycle_callbacks_order.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;
 
 /**
@@ -9,7 +13,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 _Lifecycle extends CayenneDataObject {
+public abstract class _Lifecycle extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _Lifecycle extends CayenneDataObject {
 
     public static final Property<String> NAME = Property.create("name", String.class);
 
+    protected String name;
+
+
     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;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            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;
+            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);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_Lifecycles.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_Lifecycles.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_Lifecycles.java
index a18472d..5895dbb 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_Lifecycles.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_Lifecycles.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.lifecycles.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;
 
 /**
@@ -9,7 +13,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 _Lifecycles extends CayenneDataObject {
+public abstract class _Lifecycles extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _Lifecycles extends CayenneDataObject {
 
     public static final Property<String> NAME = Property.create("name", String.class);
 
+    protected String name;
+
+
     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;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            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;
+            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);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_BlobTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_BlobTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_BlobTestEntity.java
index 9ad2f80..6e1cc8f 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_BlobTestEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_BlobTestEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.lob.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;
 
 /**
@@ -9,7 +13,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 _BlobTestEntity extends CayenneDataObject {
+public abstract class _BlobTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _BlobTestEntity extends CayenneDataObject {
 
     public static final Property<byte[]> BLOB_COL = Property.create("blobCol", byte[].class);
 
+    protected byte[] blobCol;
+
+
     public void setBlobCol(byte[] blobCol) {
-        writeProperty("blobCol", blobCol);
+        beforePropertyWrite("blobCol", this.blobCol, blobCol);
+        this.blobCol = blobCol;
     }
+
     public byte[] getBlobCol() {
-        return (byte[])readProperty("blobCol");
+        beforePropertyRead("blobCol");
+        return blobCol;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "blobCol":
+                return this.blobCol;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "blobCol":
+                this.blobCol = (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(blobCol);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        blobCol = (byte[])in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestEntity.java
index 5034c87..e5ae2e9 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestEntity.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.lob.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.lob.ClobTestRelation;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.lob.ClobTestRelation;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ClobTestEntity extends CayenneDataObject {
+public abstract class _ClobTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -21,23 +24,87 @@ public abstract class _ClobTestEntity extends CayenneDataObject {
     public static final Property<String> CLOB_COL = Property.create("clobCol", String.class);
     public static final Property<List<ClobTestRelation>> CLOB_VALUE = Property.create("clobValue", List.class);
 
+    protected String clobCol;
+
+    protected Object clobValue;
+
     public void setClobCol(String clobCol) {
-        writeProperty("clobCol", clobCol);
+        beforePropertyWrite("clobCol", this.clobCol, clobCol);
+        this.clobCol = clobCol;
     }
+
     public String getClobCol() {
-        return (String)readProperty("clobCol");
+        beforePropertyRead("clobCol");
+        return clobCol;
     }
 
     public void addToClobValue(ClobTestRelation obj) {
         addToManyTarget("clobValue", obj, true);
     }
+
     public void removeFromClobValue(ClobTestRelation obj) {
         removeToManyTarget("clobValue", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ClobTestRelation> getClobValue() {
         return (List<ClobTestRelation>)readProperty("clobValue");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "clobCol":
+                return this.clobCol;
+            case "clobValue":
+                return this.clobValue;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "clobCol":
+                this.clobCol = (String)val;
+                break;
+            case "clobValue":
+                this.clobValue = 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(clobCol);
+        out.writeObject(clobValue);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        clobCol = (String)in.readObject();
+        clobValue = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestRelation.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestRelation.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestRelation.java
index 01e3e05..3a8c35d 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestRelation.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_ClobTestRelation.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.lob.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.lob.ClobTestEntity;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.lob.ClobTestEntity;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ClobTestRelation extends CayenneDataObject {
+public abstract class _ClobTestRelation extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,18 +24,29 @@ public abstract class _ClobTestRelation extends CayenneDataObject {
     public static final Property<Integer> VALUE = Property.create("value", Integer.class);
     public static final Property<ClobTestEntity> CLOB_ID = Property.create("clobId", ClobTestEntity.class);
 
+    protected Integer id;
+    protected Integer value;
+
+    protected Object clobId;
+
     public void setId(Integer id) {
-        writeProperty("id", id);
+        beforePropertyWrite("id", this.id, id);
+        this.id = id;
     }
+
     public Integer getId() {
-        return (Integer)readProperty("id");
+        beforePropertyRead("id");
+        return id;
     }
 
     public void setValue(Integer value) {
-        writeProperty("value", value);
+        beforePropertyWrite("value", this.value, value);
+        this.value = value;
     }
+
     public Integer getValue() {
-        return (Integer)readProperty("value");
+        beforePropertyRead("value");
+        return value;
     }
 
     public void setClobId(ClobTestEntity clobId) {
@@ -42,5 +57,67 @@ public abstract class _ClobTestRelation extends CayenneDataObject {
         return (ClobTestEntity)readProperty("clobId");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "id":
+                return this.id;
+            case "value":
+                return this.value;
+            case "clobId":
+                return this.clobId;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "id":
+                this.id = (Integer)val;
+                break;
+            case "value":
+                this.value = (Integer)val;
+                break;
+            case "clobId":
+                this.clobId = 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(id);
+        out.writeObject(value);
+        out.writeObject(clobId);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        id = (Integer)in.readObject();
+        value = (Integer)in.readObject();
+        clobId = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_NClobTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_NClobTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_NClobTestEntity.java
index 56299e5..3d88ec8 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_NClobTestEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/lob/auto/_NClobTestEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.lob.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;
 
 /**
@@ -9,7 +13,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 _NClobTestEntity extends CayenneDataObject {
+public abstract class _NClobTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _NClobTestEntity extends CayenneDataObject {
 
     public static final Property<String> NCLOB_COL = Property.create("nclobCol", String.class);
 
+    protected String nclobCol;
+
+
     public void setNclobCol(String nclobCol) {
-        writeProperty("nclobCol", nclobCol);
+        beforePropertyWrite("nclobCol", this.nclobCol, nclobCol);
+        this.nclobCol = nclobCol;
     }
+
     public String getNclobCol() {
-        return (String)readProperty("nclobCol");
+        beforePropertyRead("nclobCol");
+        return nclobCol;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "nclobCol":
+                return this.nclobCol;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "nclobCol":
+                this.nclobCol = (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(nclobCol);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        nclobCol = (String)in.readObject();
     }
 
 }

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

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

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/locking/auto/_SimpleLockingTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/locking/auto/_SimpleLockingTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/locking/auto/_SimpleLockingTestEntity.java
index 4bb40f6..978e848 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/locking/auto/_SimpleLockingTestEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/locking/auto/_SimpleLockingTestEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.locking.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;
 
 /**
@@ -9,7 +13,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 _SimpleLockingTestEntity extends CayenneDataObject {
+public abstract class _SimpleLockingTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,18 +22,84 @@ public abstract class _SimpleLockingTestEntity extends CayenneDataObject {
     public static final Property<String> DESCRIPTION = Property.create("description", String.class);
     public static final Property<String> NAME = Property.create("name", String.class);
 
+    protected String description;
+    protected String name;
+
+
     public void setDescription(String description) {
-        writeProperty("description", description);
+        beforePropertyWrite("description", this.description, description);
+        this.description = description;
     }
+
     public String getDescription() {
-        return (String)readProperty("description");
+        beforePropertyRead("description");
+        return description;
     }
 
     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;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "description":
+                return this.description;
+            case "name":
+                return this.name;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "description":
+                this.description = (String)val;
+                break;
+            case "name":
+                this.name = (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(description);
+        out.writeObject(name);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        description = (String)in.readObject();
+        name = (String)in.readObject();
     }
 
 }

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

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToMany.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToMany.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToMany.java
index fc0b07f..93208bb 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToMany.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToMany.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.map_to_many.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 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.map_to_many.MapToManyTarget;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.map_to_many.MapToManyTarget;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MapToMany extends CayenneDataObject {
+public abstract class _MapToMany extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,16 +23,69 @@ public abstract class _MapToMany extends CayenneDataObject {
 
     public static final Property<Map<String, MapToManyTarget>> TARGETS = Property.create("targets", Map.class);
 
+
+    protected Object targets;
+
     public void addToTargets(MapToManyTarget obj) {
         addToManyTarget("targets", obj, true);
     }
+
     public void removeFromTargets(MapToManyTarget obj) {
         removeToManyTarget("targets", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public Map<String, MapToManyTarget> getTargets() {
         return (Map<String, MapToManyTarget>)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/map_to_many/auto/_MapToManyTarget.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToManyTarget.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToManyTarget.java
index c5c2842..8bdb39c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToManyTarget.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_MapToManyTarget.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.map_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.map_to_many.MapToMany;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.map_to_many.MapToMany;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MapToManyTarget extends CayenneDataObject {
+public abstract class _MapToManyTarget extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +23,18 @@ public abstract class _MapToManyTarget extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<MapToMany> MAP_TO_MANY = Property.create("mapToMany", MapToMany.class);
 
+    protected String name;
+
+    protected Object mapToMany;
+
     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 setMapToMany(MapToMany mapToMany) {
@@ -34,5 +45,60 @@ public abstract class _MapToManyTarget extends CayenneDataObject {
         return (MapToMany)readProperty("mapToMany");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "mapToMany":
+                return this.mapToMany;
+            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 "mapToMany":
+                this.mapToMany = 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(mapToMany);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        mapToMany = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKDep.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKDep.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKDep.java
index 7825496..e78f7a9 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKDep.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKDep.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.meaningful_pk.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.meaningful_pk.MeaningfulPKTest1;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.meaningful_pk.MeaningfulPKTest1;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MeaningfulPKDep extends CayenneDataObject {
+public abstract class _MeaningfulPKDep extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +23,18 @@ public abstract class _MeaningfulPKDep extends CayenneDataObject {
     public static final Property<String> DESCR = Property.create("descr", String.class);
     public static final Property<MeaningfulPKTest1> TO_MEANINGFUL_PK = Property.create("toMeaningfulPK", MeaningfulPKTest1.class);
 
+    protected String descr;
+
+    protected Object toMeaningfulPK;
+
     public void setDescr(String descr) {
-        writeProperty("descr", descr);
+        beforePropertyWrite("descr", this.descr, descr);
+        this.descr = descr;
     }
+
     public String getDescr() {
-        return (String)readProperty("descr");
+        beforePropertyRead("descr");
+        return descr;
     }
 
     public void setToMeaningfulPK(MeaningfulPKTest1 toMeaningfulPK) {
@@ -34,5 +45,60 @@ public abstract class _MeaningfulPKDep extends CayenneDataObject {
         return (MeaningfulPKTest1)readProperty("toMeaningfulPK");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "descr":
+                return this.descr;
+            case "toMeaningfulPK":
+                return this.toMeaningfulPK;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "descr":
+                this.descr = (String)val;
+                break;
+            case "toMeaningfulPK":
+                this.toMeaningfulPK = 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(descr);
+        out.writeObject(toMeaningfulPK);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        descr = (String)in.readObject();
+        toMeaningfulPK = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKTest1.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKTest1.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKTest1.java
index 4816c13..93bdada 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKTest1.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPKTest1.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.meaningful_pk.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.meaningful_pk.MeaningfulPKDep;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.meaningful_pk.MeaningfulPKDep;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MeaningfulPKTest1 extends CayenneDataObject {
+public abstract class _MeaningfulPKTest1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,30 +25,105 @@ public abstract class _MeaningfulPKTest1 extends CayenneDataObject {
     public static final Property<Integer> PK_ATTRIBUTE = Property.create("pkAttribute", Integer.class);
     public static final Property<List<MeaningfulPKDep>> MEANINGFUL_PKDEP_ARRAY = Property.create("meaningfulPKDepArray", List.class);
 
+    protected String descr;
+    protected Integer pkAttribute;
+
+    protected Object meaningfulPKDepArray;
+
     public void setDescr(String descr) {
-        writeProperty("descr", descr);
+        beforePropertyWrite("descr", this.descr, descr);
+        this.descr = descr;
     }
+
     public String getDescr() {
-        return (String)readProperty("descr");
+        beforePropertyRead("descr");
+        return descr;
     }
 
     public void setPkAttribute(Integer pkAttribute) {
-        writeProperty("pkAttribute", pkAttribute);
+        beforePropertyWrite("pkAttribute", this.pkAttribute, pkAttribute);
+        this.pkAttribute = pkAttribute;
     }
+
     public Integer getPkAttribute() {
-        return (Integer)readProperty("pkAttribute");
+        beforePropertyRead("pkAttribute");
+        return pkAttribute;
     }
 
     public void addToMeaningfulPKDepArray(MeaningfulPKDep obj) {
         addToManyTarget("meaningfulPKDepArray", obj, true);
     }
+
     public void removeFromMeaningfulPKDepArray(MeaningfulPKDep obj) {
         removeToManyTarget("meaningfulPKDepArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<MeaningfulPKDep> getMeaningfulPKDepArray() {
         return (List<MeaningfulPKDep>)readProperty("meaningfulPKDepArray");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "descr":
+                return this.descr;
+            case "pkAttribute":
+                return this.pkAttribute;
+            case "meaningfulPKDepArray":
+                return this.meaningfulPKDepArray;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "descr":
+                this.descr = (String)val;
+                break;
+            case "pkAttribute":
+                this.pkAttribute = (Integer)val;
+                break;
+            case "meaningfulPKDepArray":
+                this.meaningfulPKDepArray = 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(descr);
+        out.writeObject(pkAttribute);
+        out.writeObject(meaningfulPKDepArray);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        descr = (String)in.readObject();
+        pkAttribute = (Integer)in.readObject();
+        meaningfulPKDepArray = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPk.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPk.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPk.java
index b988ecd..16f13ab 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPk.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_MeaningfulPk.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.meaningful_pk.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;
 
 /**
@@ -9,7 +13,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 _MeaningfulPk extends CayenneDataObject {
+public abstract class _MeaningfulPk extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _MeaningfulPk extends CayenneDataObject {
 
     public static final Property<String> PK = Property.create("pk", String.class);
 
+    protected String pk;
+
+
     public void setPk(String pk) {
-        writeProperty("pk", pk);
+        beforePropertyWrite("pk", this.pk, pk);
+        this.pk = pk;
     }
+
     public String getPk() {
-        return (String)readProperty("pk");
+        beforePropertyRead("pk");
+        return pk;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "pk":
+                return this.pk;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "pk":
+                this.pk = (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(pk);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        pk = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_ArraysEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_ArraysEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_ArraysEntity.java
index 611b076..7d5ac6e 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_ArraysEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_ArraysEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.misc_types.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;
 
 /**
@@ -9,7 +13,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 _ArraysEntity extends CayenneDataObject {
+public abstract class _ArraysEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,32 +24,120 @@ public abstract class _ArraysEntity extends CayenneDataObject {
     public static final Property<char[]> CHAR_ARRAY = Property.create("charArray", char[].class);
     public static final Property<Character[]> CHAR_WRAPPER_ARRAY = Property.create("charWrapperArray", Character[].class);
 
+    protected byte[] byteArray;
+    protected Byte[] byteWrapperArray;
+    protected char[] charArray;
+    protected Character[] charWrapperArray;
+
+
     public void setByteArray(byte[] byteArray) {
-        writeProperty("byteArray", byteArray);
+        beforePropertyWrite("byteArray", this.byteArray, byteArray);
+        this.byteArray = byteArray;
     }
+
     public byte[] getByteArray() {
-        return (byte[])readProperty("byteArray");
+        beforePropertyRead("byteArray");
+        return byteArray;
     }
 
     public void setByteWrapperArray(Byte[] byteWrapperArray) {
-        writeProperty("byteWrapperArray", byteWrapperArray);
+        beforePropertyWrite("byteWrapperArray", this.byteWrapperArray, byteWrapperArray);
+        this.byteWrapperArray = byteWrapperArray;
     }
+
     public Byte[] getByteWrapperArray() {
-        return (Byte[])readProperty("byteWrapperArray");
+        beforePropertyRead("byteWrapperArray");
+        return byteWrapperArray;
     }
 
     public void setCharArray(char[] charArray) {
-        writeProperty("charArray", charArray);
+        beforePropertyWrite("charArray", this.charArray, charArray);
+        this.charArray = charArray;
     }
+
     public char[] getCharArray() {
-        return (char[])readProperty("charArray");
+        beforePropertyRead("charArray");
+        return charArray;
     }
 
     public void setCharWrapperArray(Character[] charWrapperArray) {
-        writeProperty("charWrapperArray", charWrapperArray);
+        beforePropertyWrite("charWrapperArray", this.charWrapperArray, charWrapperArray);
+        this.charWrapperArray = charWrapperArray;
     }
+
     public Character[] getCharWrapperArray() {
-        return (Character[])readProperty("charWrapperArray");
+        beforePropertyRead("charWrapperArray");
+        return charWrapperArray;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "byteArray":
+                return this.byteArray;
+            case "byteWrapperArray":
+                return this.byteWrapperArray;
+            case "charArray":
+                return this.charArray;
+            case "charWrapperArray":
+                return this.charWrapperArray;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "byteArray":
+                this.byteArray = (byte[])val;
+                break;
+            case "byteWrapperArray":
+                this.byteWrapperArray = (Byte[])val;
+                break;
+            case "charArray":
+                this.charArray = (char[])val;
+                break;
+            case "charWrapperArray":
+                this.charWrapperArray = (Character[])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(byteArray);
+        out.writeObject(byteWrapperArray);
+        out.writeObject(charArray);
+        out.writeObject(charWrapperArray);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        byteArray = (byte[])in.readObject();
+        byteWrapperArray = (Byte[])in.readObject();
+        charArray = (char[])in.readObject();
+        charWrapperArray = (Character[])in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_CharacterEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_CharacterEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_CharacterEntity.java
index 836ecc1..1163888 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_CharacterEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_CharacterEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.misc_types.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;
 
 /**
@@ -9,7 +13,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 _CharacterEntity extends CayenneDataObject {
+public abstract class _CharacterEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _CharacterEntity extends CayenneDataObject {
 
     public static final Property<Character> CHARACTER_FIELD = Property.create("characterField", Character.class);
 
+    protected Character characterField;
+
+
     public void setCharacterField(Character characterField) {
-        writeProperty("characterField", characterField);
+        beforePropertyWrite("characterField", this.characterField, characterField);
+        this.characterField = characterField;
     }
+
     public Character getCharacterField() {
-        return (Character)readProperty("characterField");
+        beforePropertyRead("characterField");
+        return characterField;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "characterField":
+                return this.characterField;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "characterField":
+                this.characterField = (Character)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(characterField);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        characterField = (Character)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_SerializableEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_SerializableEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_SerializableEntity.java
index 1512815..2f9adf1 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_SerializableEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/misc_types/auto/_SerializableEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.misc_types.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.MockSerializable;
 import org.apache.cayenne.exp.Property;
 
@@ -10,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 _SerializableEntity extends CayenneDataObject {
+public abstract class _SerializableEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,11 +22,66 @@ public abstract class _SerializableEntity extends CayenneDataObject {
 
     public static final Property<MockSerializable> SERIALIZABLE_FIELD = Property.create("serializableField", MockSerializable.class);
 
+    protected MockSerializable serializableField;
+
+
     public void setSerializableField(MockSerializable serializableField) {
-        writeProperty("serializableField", serializableField);
+        beforePropertyWrite("serializableField", this.serializableField, serializableField);
+        this.serializableField = serializableField;
     }
+
     public MockSerializable getSerializableField() {
-        return (MockSerializable)readProperty("serializableField");
+        beforePropertyRead("serializableField");
+        return serializableField;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "serializableField":
+                return this.serializableField;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "serializableField":
+                this.serializableField = (MockSerializable)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(serializableField);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        serializableField = (MockSerializable)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy.java
index b3f8b88..e2427ee 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.mixed_persistence_strategy.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.mixed_persistence_strategy.MixedPersistenceStrategy2;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.mixed_persistence_strategy.MixedPersistenceStra
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MixedPersistenceStrategy extends CayenneDataObject {
+public abstract class _MixedPersistenceStrategy extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,30 +25,105 @@ public abstract class _MixedPersistenceStrategy extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<List<MixedPersistenceStrategy2>> DETAILS = Property.create("details", List.class);
 
+    protected String description;
+    protected String name;
+
+    protected Object details;
+
     public void setDescription(String description) {
-        writeProperty("description", description);
+        beforePropertyWrite("description", this.description, description);
+        this.description = description;
     }
+
     public String getDescription() {
-        return (String)readProperty("description");
+        beforePropertyRead("description");
+        return description;
     }
 
     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(MixedPersistenceStrategy2 obj) {
         addToManyTarget("details", obj, true);
     }
+
     public void removeFromDetails(MixedPersistenceStrategy2 obj) {
         removeToManyTarget("details", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<MixedPersistenceStrategy2> getDetails() {
         return (List<MixedPersistenceStrategy2>)readProperty("details");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "description":
+                return this.description;
+            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 "description":
+                this.description = (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(description);
+        out.writeObject(name);
+        out.writeObject(details);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        description = (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/mixed_persistence_strategy/auto/_MixedPersistenceStrategy2.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy2.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy2.java
index 227192d..300c2b3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy2.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/mixed_persistence_strategy/auto/_MixedPersistenceStrategy2.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.mixed_persistence_strategy.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.mixed_persistence_strategy.MixedPersistenceStrategy;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.mixed_persistence_strategy.MixedPersistenceStra
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MixedPersistenceStrategy2 extends CayenneDataObject {
+public abstract class _MixedPersistenceStrategy2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +23,18 @@ public abstract class _MixedPersistenceStrategy2 extends CayenneDataObject {
     public static final Property<String> NAME = Property.create("name", String.class);
     public static final Property<MixedPersistenceStrategy> MASTER = Property.create("master", MixedPersistenceStrategy.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(MixedPersistenceStrategy master) {
@@ -34,5 +45,60 @@ public abstract class _MixedPersistenceStrategy2 extends CayenneDataObject {
         return (MixedPersistenceStrategy)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();
+    }
 
 }


Mime
View raw message