cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [4/4] cayenne git commit: CAY-2467 New type-aware Property API - update tests classes in modules
Date Fri, 28 Dec 2018 12:38:25 GMT
CAY-2467 New type-aware Property API
  - update tests classes in modules


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/2cca2445
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/2cca2445
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/2cca2445

Branch: refs/heads/master
Commit: 2cca2445f8e607db11e227385ed57aa3f2ca1844
Parents: 63a32d8
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Dec 28 15:38:15 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Dec 28 15:38:15 2018 +0300

----------------------------------------------------------------------
 .../cayenne/commitlog/db/auto/_AuditLog.java    |  72 +++++++-
 .../cayenne/commitlog/db/auto/_Auditable1.java  |  83 ++++++++-
 .../cayenne/commitlog/db/auto/_Auditable2.java  | 100 +++++++++--
 .../cayenne/commitlog/db/auto/_Auditable3.java  | 100 +++++++++--
 .../cayenne/commitlog/db/auto/_Auditable4.java  |  99 +++++++++--
 .../commitlog/db/auto/_AuditableChild1.java     |  82 ++++++++-
 .../commitlog/db/auto/_AuditableChild3.java     |  99 +++++++++--
 .../apache/cayenne/commitlog/db/auto/_E1.java   |  52 +++++-
 .../apache/cayenne/commitlog/db/auto/_E2.java   |  52 +++++-
 .../apache/cayenne/commitlog/db/auto/_E3.java   |  65 ++++++-
 .../apache/cayenne/commitlog/db/auto/_E4.java   |  65 ++++++-
 .../joda/db/auto/_DateTimeTestEntity.java       |  72 +++++++-
 .../joda/db/auto/_LocalDateTestEntity.java      |  72 +++++++-
 .../joda/db/auto/_LocalDateTimeTestEntity.java  |  72 +++++++-
 .../joda/db/auto/_LocalTimeTestEntity.java      |  72 +++++++-
 .../protostuff/persistent/auto/_MtTable1.java   | 169 ++++++++++++++++---
 .../protostuff/persistent/auto/_MtTable2.java   |  82 ++++++++-
 17 files changed, 1283 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditLog.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditLog.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditLog.java
index d937b03..9caf55f 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditLog.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditLog.java
@@ -1,7 +1,12 @@
 package org.apache.cayenne.commitlog.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 
 /**
  * Class _AuditLog was generated by Cayenne.
@@ -9,19 +14,74 @@ 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 _AuditLog extends CayenneDataObject {
+public abstract class _AuditLog extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> LOG = Property.create("log", String.class);
+    public static final StringProperty<String> LOG = PropertyFactory.createString("log", String.class);
+
+    protected String log;
+
 
     public void setLog(String log) {
-        writeProperty("log", log);
+        beforePropertyWrite("log", this.log, log);
+        this.log = log;
     }
+
     public String getLog() {
-        return (String)readProperty("log");
+        beforePropertyRead("log");
+        return this.log;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "log":
+                return this.log;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "log":
+                this.log = (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(this.log);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.log = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable1.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable1.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable1.java
index 1f05a74..1493a56 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable1.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable1.java
@@ -1,10 +1,15 @@
 package org.apache.cayenne.commitlog.db.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.exp.Property;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.AuditableChild1;
+import org.apache.cayenne.exp.property.ListProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 
 /**
  * Class _Auditable1 was generated by Cayenne.
@@ -12,32 +17,96 @@ import org.apache.cayenne.commitlog.db.AuditableChild1;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Auditable1 extends CayenneDataObject {
+public abstract class _Auditable1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> CHAR_PROPERTY1 = Property.create("charProperty1", String.class);
-    public static final Property<List<AuditableChild1>> CHILDREN1 = Property.create("children1", List.class);
+    public static final StringProperty<String> CHAR_PROPERTY1 = PropertyFactory.createString("charProperty1", String.class);
+    public static final ListProperty<AuditableChild1> CHILDREN1 = PropertyFactory.createList("children1", AuditableChild1.class);
+
+    protected String charProperty1;
+
+    protected Object children1;
 
     public void setCharProperty1(String charProperty1) {
-        writeProperty("charProperty1", charProperty1);
+        beforePropertyWrite("charProperty1", this.charProperty1, charProperty1);
+        this.charProperty1 = charProperty1;
     }
+
     public String getCharProperty1() {
-        return (String)readProperty("charProperty1");
+        beforePropertyRead("charProperty1");
+        return this.charProperty1;
     }
 
     public void addToChildren1(AuditableChild1 obj) {
         addToManyTarget("children1", obj, true);
     }
+
     public void removeFromChildren1(AuditableChild1 obj) {
         removeToManyTarget("children1", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<AuditableChild1> getChildren1() {
         return (List<AuditableChild1>)readProperty("children1");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "charProperty1":
+                return this.charProperty1;
+            case "children1":
+                return this.children1;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "charProperty1":
+                this.charProperty1 = (String)val;
+                break;
+            case "children1":
+                this.children1 = 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(this.charProperty1);
+        out.writeObject(this.children1);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.charProperty1 = (String)in.readObject();
+        this.children1 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable2.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable2.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable2.java
index fff2543..3c23f66 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable2.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable2.java
@@ -1,10 +1,15 @@
 package org.apache.cayenne.commitlog.db.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.exp.Property;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.AuditableChild3;
+import org.apache.cayenne.exp.property.ListProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 
 /**
  * Class _Auditable2 was generated by Cayenne.
@@ -12,40 +17,115 @@ import org.apache.cayenne.commitlog.db.AuditableChild3;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Auditable2 extends CayenneDataObject {
+public abstract class _Auditable2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> CHAR_PROPERTY1 = Property.create("charProperty1", String.class);
-    public static final Property<String> CHAR_PROPERTY2 = Property.create("charProperty2", String.class);
-    public static final Property<List<AuditableChild3>> CHILDREN = Property.create("children", List.class);
+    public static final StringProperty<String> CHAR_PROPERTY1 = PropertyFactory.createString("charProperty1", String.class);
+    public static final StringProperty<String> CHAR_PROPERTY2 = PropertyFactory.createString("charProperty2", String.class);
+    public static final ListProperty<AuditableChild3> CHILDREN = PropertyFactory.createList("children", AuditableChild3.class);
+
+    protected String charProperty1;
+    protected String charProperty2;
+
+    protected Object children;
 
     public void setCharProperty1(String charProperty1) {
-        writeProperty("charProperty1", charProperty1);
+        beforePropertyWrite("charProperty1", this.charProperty1, charProperty1);
+        this.charProperty1 = charProperty1;
     }
+
     public String getCharProperty1() {
-        return (String)readProperty("charProperty1");
+        beforePropertyRead("charProperty1");
+        return this.charProperty1;
     }
 
     public void setCharProperty2(String charProperty2) {
-        writeProperty("charProperty2", charProperty2);
+        beforePropertyWrite("charProperty2", this.charProperty2, charProperty2);
+        this.charProperty2 = charProperty2;
     }
+
     public String getCharProperty2() {
-        return (String)readProperty("charProperty2");
+        beforePropertyRead("charProperty2");
+        return this.charProperty2;
     }
 
     public void addToChildren(AuditableChild3 obj) {
         addToManyTarget("children", obj, true);
     }
+
     public void removeFromChildren(AuditableChild3 obj) {
         removeToManyTarget("children", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<AuditableChild3> getChildren() {
         return (List<AuditableChild3>)readProperty("children");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "charProperty1":
+                return this.charProperty1;
+            case "charProperty2":
+                return this.charProperty2;
+            case "children":
+                return this.children;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "charProperty1":
+                this.charProperty1 = (String)val;
+                break;
+            case "charProperty2":
+                this.charProperty2 = (String)val;
+                break;
+            case "children":
+                this.children = val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(this.charProperty1);
+        out.writeObject(this.charProperty2);
+        out.writeObject(this.children);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.charProperty1 = (String)in.readObject();
+        this.charProperty2 = (String)in.readObject();
+        this.children = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable3.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable3.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable3.java
index 464f121..98c4e2b 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable3.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable3.java
@@ -1,10 +1,15 @@
 package org.apache.cayenne.commitlog.db.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.exp.Property;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.Auditable4;
+import org.apache.cayenne.exp.property.ListProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 
 /**
  * Class _Auditable3 was generated by Cayenne.
@@ -12,40 +17,115 @@ import org.apache.cayenne.commitlog.db.Auditable4;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Auditable3 extends CayenneDataObject {
+public abstract class _Auditable3 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> CHAR_PROPERTY1 = Property.create("charProperty1", String.class);
-    public static final Property<String> CHAR_PROPERTY2 = Property.create("charProperty2", String.class);
-    public static final Property<List<Auditable4>> AUDITABLE4S = Property.create("auditable4s", List.class);
+    public static final StringProperty<String> CHAR_PROPERTY1 = PropertyFactory.createString("charProperty1", String.class);
+    public static final StringProperty<String> CHAR_PROPERTY2 = PropertyFactory.createString("charProperty2", String.class);
+    public static final ListProperty<Auditable4> AUDITABLE4S = PropertyFactory.createList("auditable4s", Auditable4.class);
+
+    protected String charProperty1;
+    protected String charProperty2;
+
+    protected Object auditable4s;
 
     public void setCharProperty1(String charProperty1) {
-        writeProperty("charProperty1", charProperty1);
+        beforePropertyWrite("charProperty1", this.charProperty1, charProperty1);
+        this.charProperty1 = charProperty1;
     }
+
     public String getCharProperty1() {
-        return (String)readProperty("charProperty1");
+        beforePropertyRead("charProperty1");
+        return this.charProperty1;
     }
 
     public void setCharProperty2(String charProperty2) {
-        writeProperty("charProperty2", charProperty2);
+        beforePropertyWrite("charProperty2", this.charProperty2, charProperty2);
+        this.charProperty2 = charProperty2;
     }
+
     public String getCharProperty2() {
-        return (String)readProperty("charProperty2");
+        beforePropertyRead("charProperty2");
+        return this.charProperty2;
     }
 
     public void addToAuditable4s(Auditable4 obj) {
         addToManyTarget("auditable4s", obj, true);
     }
+
     public void removeFromAuditable4s(Auditable4 obj) {
         removeToManyTarget("auditable4s", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Auditable4> getAuditable4s() {
         return (List<Auditable4>)readProperty("auditable4s");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "charProperty1":
+                return this.charProperty1;
+            case "charProperty2":
+                return this.charProperty2;
+            case "auditable4s":
+                return this.auditable4s;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "charProperty1":
+                this.charProperty1 = (String)val;
+                break;
+            case "charProperty2":
+                this.charProperty2 = (String)val;
+                break;
+            case "auditable4s":
+                this.auditable4s = 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(this.charProperty1);
+        out.writeObject(this.charProperty2);
+        out.writeObject(this.auditable4s);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.charProperty1 = (String)in.readObject();
+        this.charProperty2 = (String)in.readObject();
+        this.auditable4s = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable4.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable4.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable4.java
index 23aa652..a39fda5 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable4.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_Auditable4.java
@@ -1,8 +1,14 @@
 package org.apache.cayenne.commitlog.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.Auditable3;
+import org.apache.cayenne.exp.property.EntityProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 
 /**
  * Class _Auditable4 was generated by Cayenne.
@@ -10,28 +16,39 @@ import org.apache.cayenne.commitlog.db.Auditable3;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Auditable4 extends CayenneDataObject {
+public abstract class _Auditable4 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> CHAR_PROPERTY1 = Property.create("charProperty1", String.class);
-    public static final Property<String> CHAR_PROPERTY2 = Property.create("charProperty2", String.class);
-    public static final Property<Auditable3> AUDITABLE3 = Property.create("auditable3", Auditable3.class);
+    public static final StringProperty<String> CHAR_PROPERTY1 = PropertyFactory.createString("charProperty1", String.class);
+    public static final StringProperty<String> CHAR_PROPERTY2 = PropertyFactory.createString("charProperty2", String.class);
+    public static final EntityProperty<Auditable3> AUDITABLE3 = PropertyFactory.createEntity("auditable3", Auditable3.class);
+
+    protected String charProperty1;
+    protected String charProperty2;
+
+    protected Object auditable3;
 
     public void setCharProperty1(String charProperty1) {
-        writeProperty("charProperty1", charProperty1);
+        beforePropertyWrite("charProperty1", this.charProperty1, charProperty1);
+        this.charProperty1 = charProperty1;
     }
+
     public String getCharProperty1() {
-        return (String)readProperty("charProperty1");
+        beforePropertyRead("charProperty1");
+        return this.charProperty1;
     }
 
     public void setCharProperty2(String charProperty2) {
-        writeProperty("charProperty2", charProperty2);
+        beforePropertyWrite("charProperty2", this.charProperty2, charProperty2);
+        this.charProperty2 = charProperty2;
     }
+
     public String getCharProperty2() {
-        return (String)readProperty("charProperty2");
+        beforePropertyRead("charProperty2");
+        return this.charProperty2;
     }
 
     public void setAuditable3(Auditable3 auditable3) {
@@ -42,5 +59,67 @@ public abstract class _Auditable4 extends CayenneDataObject {
         return (Auditable3)readProperty("auditable3");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "charProperty1":
+                return this.charProperty1;
+            case "charProperty2":
+                return this.charProperty2;
+            case "auditable3":
+                return this.auditable3;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "charProperty1":
+                this.charProperty1 = (String)val;
+                break;
+            case "charProperty2":
+                this.charProperty2 = (String)val;
+                break;
+            case "auditable3":
+                this.auditable3 = 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(this.charProperty1);
+        out.writeObject(this.charProperty2);
+        out.writeObject(this.auditable3);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.charProperty1 = (String)in.readObject();
+        this.charProperty2 = (String)in.readObject();
+        this.auditable3 = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild1.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild1.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild1.java
index bc53ce4..e400898 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild1.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild1.java
@@ -1,8 +1,14 @@
 package org.apache.cayenne.commitlog.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.Auditable1;
+import org.apache.cayenne.exp.property.EntityProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 
 /**
  * Class _AuditableChild1 was generated by Cayenne.
@@ -10,20 +16,27 @@ import org.apache.cayenne.commitlog.db.Auditable1;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _AuditableChild1 extends CayenneDataObject {
+public abstract class _AuditableChild1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> CHAR_PROPERTY1 = Property.create("charProperty1", String.class);
-    public static final Property<Auditable1> PARENT = Property.create("parent", Auditable1.class);
+    public static final StringProperty<String> CHAR_PROPERTY1 = PropertyFactory.createString("charProperty1", String.class);
+    public static final EntityProperty<Auditable1> PARENT = PropertyFactory.createEntity("parent", Auditable1.class);
+
+    protected String charProperty1;
+
+    protected Object parent;
 
     public void setCharProperty1(String charProperty1) {
-        writeProperty("charProperty1", charProperty1);
+        beforePropertyWrite("charProperty1", this.charProperty1, charProperty1);
+        this.charProperty1 = charProperty1;
     }
+
     public String getCharProperty1() {
-        return (String)readProperty("charProperty1");
+        beforePropertyRead("charProperty1");
+        return this.charProperty1;
     }
 
     public void setParent(Auditable1 parent) {
@@ -34,5 +47,60 @@ public abstract class _AuditableChild1 extends CayenneDataObject {
         return (Auditable1)readProperty("parent");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "charProperty1":
+                return this.charProperty1;
+            case "parent":
+                return this.parent;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "charProperty1":
+                this.charProperty1 = (String)val;
+                break;
+            case "parent":
+                this.parent = 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(this.charProperty1);
+        out.writeObject(this.parent);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.charProperty1 = (String)in.readObject();
+        this.parent = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild3.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild3.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild3.java
index c09b035..1a23f3a 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild3.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_AuditableChild3.java
@@ -1,8 +1,14 @@
 package org.apache.cayenne.commitlog.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.Auditable2;
+import org.apache.cayenne.exp.property.EntityProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 
 /**
  * Class _AuditableChild3 was generated by Cayenne.
@@ -10,28 +16,39 @@ import org.apache.cayenne.commitlog.db.Auditable2;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _AuditableChild3 extends CayenneDataObject {
+public abstract class _AuditableChild3 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<String> CHAR_PROPERTY1 = Property.create("charProperty1", String.class);
-    public static final Property<String> CHAR_PROPERTY2 = Property.create("charProperty2", String.class);
-    public static final Property<Auditable2> PARENT = Property.create("parent", Auditable2.class);
+    public static final StringProperty<String> CHAR_PROPERTY1 = PropertyFactory.createString("charProperty1", String.class);
+    public static final StringProperty<String> CHAR_PROPERTY2 = PropertyFactory.createString("charProperty2", String.class);
+    public static final EntityProperty<Auditable2> PARENT = PropertyFactory.createEntity("parent", Auditable2.class);
+
+    protected String charProperty1;
+    protected String charProperty2;
+
+    protected Object parent;
 
     public void setCharProperty1(String charProperty1) {
-        writeProperty("charProperty1", charProperty1);
+        beforePropertyWrite("charProperty1", this.charProperty1, charProperty1);
+        this.charProperty1 = charProperty1;
     }
+
     public String getCharProperty1() {
-        return (String)readProperty("charProperty1");
+        beforePropertyRead("charProperty1");
+        return this.charProperty1;
     }
 
     public void setCharProperty2(String charProperty2) {
-        writeProperty("charProperty2", charProperty2);
+        beforePropertyWrite("charProperty2", this.charProperty2, charProperty2);
+        this.charProperty2 = charProperty2;
     }
+
     public String getCharProperty2() {
-        return (String)readProperty("charProperty2");
+        beforePropertyRead("charProperty2");
+        return this.charProperty2;
     }
 
     public void setParent(Auditable2 parent) {
@@ -42,5 +59,67 @@ public abstract class _AuditableChild3 extends CayenneDataObject {
         return (Auditable2)readProperty("parent");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "charProperty1":
+                return this.charProperty1;
+            case "charProperty2":
+                return this.charProperty2;
+            case "parent":
+                return this.parent;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "charProperty1":
+                this.charProperty1 = (String)val;
+                break;
+            case "charProperty2":
+                this.charProperty2 = (String)val;
+                break;
+            case "parent":
+                this.parent = 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(this.charProperty1);
+        out.writeObject(this.charProperty2);
+        out.writeObject(this.parent);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.charProperty1 = (String)in.readObject();
+        this.charProperty2 = (String)in.readObject();
+        this.parent = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E1.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E1.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E1.java
index 74fe998..3ec47e2 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E1.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E1.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.commitlog.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 
 /**
  * Class _E1 was generated by Cayenne.
@@ -8,11 +12,55 @@ import org.apache.cayenne.CayenneDataObject;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _E1 extends CayenneDataObject {
+public abstract class _E1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
 
+
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            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);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E2.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E2.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E2.java
index 89d9852..33a8bee 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E2.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E2.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.commitlog.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
 
 /**
  * Class _E2 was generated by Cayenne.
@@ -8,11 +12,55 @@ import org.apache.cayenne.CayenneDataObject;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _E2 extends CayenneDataObject {
+public abstract class _E2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
 
+
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            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);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E3.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E3.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E3.java
index 99fe863..2160b8f 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E3.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E3.java
@@ -1,10 +1,14 @@
 package org.apache.cayenne.commitlog.db.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.exp.Property;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.E4;
+import org.apache.cayenne.exp.property.ListProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
 
 /**
  * Class _E3 was generated by Cayenne.
@@ -12,24 +16,77 @@ import org.apache.cayenne.commitlog.db.E4;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _E3 extends CayenneDataObject {
+public abstract class _E3 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<List<E4>> E4S = Property.create("e4s", List.class);
+    public static final ListProperty<E4> E4S = PropertyFactory.createList("e4s", E4.class);
+
+
+    protected Object e4s;
 
     public void addToE4s(E4 obj) {
         addToManyTarget("e4s", obj, true);
     }
+
     public void removeFromE4s(E4 obj) {
         removeToManyTarget("e4s", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<E4> getE4s() {
         return (List<E4>)readProperty("e4s");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "e4s":
+                return this.e4s;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "e4s":
+                this.e4s = 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(this.e4s);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.e4s = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E4.java
----------------------------------------------------------------------
diff --git a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E4.java b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E4.java
index c2cefdc..22e4621 100644
--- a/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E4.java
+++ b/cayenne-commitlog/src/test/java/org/apache/cayenne/commitlog/db/auto/_E4.java
@@ -1,10 +1,14 @@
 package org.apache.cayenne.commitlog.db.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.exp.Property;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.commitlog.db.E3;
+import org.apache.cayenne.exp.property.ListProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
 
 /**
  * Class _E4 was generated by Cayenne.
@@ -12,24 +16,77 @@ import org.apache.cayenne.commitlog.db.E3;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _E4 extends CayenneDataObject {
+public abstract class _E4 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<List<E3>> E3S = Property.create("e3s", List.class);
+    public static final ListProperty<E3> E3S = PropertyFactory.createList("e3s", E3.class);
+
+
+    protected Object e3s;
 
     public void addToE3s(E3 obj) {
         addToManyTarget("e3s", obj, true);
     }
+
     public void removeFromE3s(E3 obj) {
         removeToManyTarget("e3s", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<E3> getE3s() {
         return (List<E3>)readProperty("e3s");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "e3s":
+                return this.e3s;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "e3s":
+                this.e3s = 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(this.e3s);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.e3s = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java
index 2fd9d91..9138bdc 100644
--- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java
+++ b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_DateTimeTestEntity.java
@@ -1,7 +1,12 @@
 package org.apache.cayenne.joda.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.property.BaseProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
 import org.joda.time.DateTime;
 
 /**
@@ -10,19 +15,74 @@ import org.joda.time.DateTime;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _DateTimeTestEntity extends CayenneDataObject {
+public abstract class _DateTimeTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<DateTime> TIMESTAMP = Property.create("timestamp", DateTime.class);
+    public static final BaseProperty<DateTime> TIMESTAMP = PropertyFactory.createBase("timestamp", DateTime.class);
+
+    protected DateTime timestamp;
+
 
     public void setTimestamp(DateTime timestamp) {
-        writeProperty("timestamp", timestamp);
+        beforePropertyWrite("timestamp", this.timestamp, timestamp);
+        this.timestamp = timestamp;
     }
+
     public DateTime getTimestamp() {
-        return (DateTime)readProperty("timestamp");
+        beforePropertyRead("timestamp");
+        return this.timestamp;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "timestamp":
+                return this.timestamp;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "timestamp":
+                this.timestamp = (DateTime)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(this.timestamp);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.timestamp = (DateTime)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java
index 72c60dd..2542bd3 100644
--- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java
+++ b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTestEntity.java
@@ -1,7 +1,12 @@
 package org.apache.cayenne.joda.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.property.BaseProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
 import org.joda.time.LocalDate;
 
 /**
@@ -10,19 +15,74 @@ import org.joda.time.LocalDate;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _LocalDateTestEntity extends CayenneDataObject {
+public abstract class _LocalDateTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<LocalDate> DATE = Property.create("date", LocalDate.class);
+    public static final BaseProperty<LocalDate> DATE = PropertyFactory.createBase("date", LocalDate.class);
+
+    protected LocalDate date;
+
 
     public void setDate(LocalDate date) {
-        writeProperty("date", date);
+        beforePropertyWrite("date", this.date, date);
+        this.date = date;
     }
+
     public LocalDate getDate() {
-        return (LocalDate)readProperty("date");
+        beforePropertyRead("date");
+        return this.date;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "date":
+                return this.date;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "date":
+                this.date = (LocalDate)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(this.date);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.date = (LocalDate)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java
index bca6b26..ee812ab 100644
--- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java
+++ b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalDateTimeTestEntity.java
@@ -1,7 +1,12 @@
 package org.apache.cayenne.joda.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.property.BaseProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
 import org.joda.time.LocalDateTime;
 
 /**
@@ -10,19 +15,74 @@ import org.joda.time.LocalDateTime;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _LocalDateTimeTestEntity extends CayenneDataObject {
+public abstract class _LocalDateTimeTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<LocalDateTime> TIMESTAMP = Property.create("timestamp", LocalDateTime.class);
+    public static final BaseProperty<LocalDateTime> TIMESTAMP = PropertyFactory.createBase("timestamp", LocalDateTime.class);
+
+    protected LocalDateTime timestamp;
+
 
     public void setTimestamp(LocalDateTime timestamp) {
-        writeProperty("timestamp", timestamp);
+        beforePropertyWrite("timestamp", this.timestamp, timestamp);
+        this.timestamp = timestamp;
     }
+
     public LocalDateTime getTimestamp() {
-        return (LocalDateTime)readProperty("timestamp");
+        beforePropertyRead("timestamp");
+        return this.timestamp;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "timestamp":
+                return this.timestamp;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "timestamp":
+                this.timestamp = (LocalDateTime)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(this.timestamp);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.timestamp = (LocalDateTime)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java
index 422ceec..903f244 100644
--- a/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java
+++ b/cayenne-joda/src/test/java/org/apache/cayenne/joda/db/auto/_LocalTimeTestEntity.java
@@ -1,7 +1,12 @@
 package org.apache.cayenne.joda.db.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.property.BaseProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
 import org.joda.time.LocalTime;
 
 /**
@@ -10,19 +15,74 @@ import org.joda.time.LocalTime;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _LocalTimeTestEntity extends CayenneDataObject {
+public abstract class _LocalTimeTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String ID_PK_COLUMN = "ID";
 
-    public static final Property<LocalTime> TIME = Property.create("time", LocalTime.class);
+    public static final BaseProperty<LocalTime> TIME = PropertyFactory.createBase("time", LocalTime.class);
+
+    protected LocalTime time;
+
 
     public void setTime(LocalTime time) {
-        writeProperty("time", time);
+        beforePropertyWrite("time", this.time, time);
+        this.time = time;
     }
+
     public LocalTime getTime() {
-        return (LocalTime)readProperty("time");
+        beforePropertyRead("time");
+        return this.time;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "time":
+                return this.time;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "time":
+                this.time = (LocalTime)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(this.time);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.time = (LocalTime)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java
----------------------------------------------------------------------
diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java
index b512ac0..97537bf 100644
--- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java
+++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable1.java
@@ -1,13 +1,19 @@
 package org.apache.cayenne.rop.protostuff.persistent.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.util.Date;
 import java.util.List;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.property.DateProperty;
+import org.apache.cayenne.exp.property.ListProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 import org.apache.cayenne.rop.protostuff.persistent.MtTable2;
 
 /**
@@ -16,72 +22,191 @@ import org.apache.cayenne.rop.protostuff.persistent.MtTable2;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MtTable1 extends CayenneDataObject {
+public abstract class _MtTable1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String TABLE1_ID_PK_COLUMN = "TABLE1_ID";
 
-    public static final Property<LocalDate> DATE_ATTRIBUTE = Property.create("dateAttribute", LocalDate.class);
-    public static final Property<String> GLOBAL_ATTRIBUTE = Property.create("globalAttribute", String.class);
-    public static final Property<Date> OLD_DATE_ATTRIBUTE = Property.create("oldDateAttribute", Date.class);
-    public static final Property<String> SERVER_ATTRIBUTE = Property.create("serverAttribute", String.class);
-    public static final Property<LocalTime> TIME_ATTRIBUTE = Property.create("timeAttribute", LocalTime.class);
-    public static final Property<LocalDateTime> TIMESTAMP_ATTRIBUTE = Property.create("timestampAttribute", LocalDateTime.class);
-    public static final Property<List<MtTable2>> TABLE2ARRAY = Property.create("table2Array", List.class);
+    public static final DateProperty<LocalDate> DATE_ATTRIBUTE = PropertyFactory.createDate("dateAttribute", LocalDate.class);
+    public static final StringProperty<String> GLOBAL_ATTRIBUTE = PropertyFactory.createString("globalAttribute", String.class);
+    public static final DateProperty<Date> OLD_DATE_ATTRIBUTE = PropertyFactory.createDate("oldDateAttribute", Date.class);
+    public static final StringProperty<String> SERVER_ATTRIBUTE = PropertyFactory.createString("serverAttribute", String.class);
+    public static final DateProperty<LocalTime> TIME_ATTRIBUTE = PropertyFactory.createDate("timeAttribute", LocalTime.class);
+    public static final DateProperty<LocalDateTime> TIMESTAMP_ATTRIBUTE = PropertyFactory.createDate("timestampAttribute", LocalDateTime.class);
+    public static final ListProperty<MtTable2> TABLE2ARRAY = PropertyFactory.createList("table2Array", MtTable2.class);
+
+    protected LocalDate dateAttribute;
+    protected String globalAttribute;
+    protected Date oldDateAttribute;
+    protected String serverAttribute;
+    protected LocalTime timeAttribute;
+    protected LocalDateTime timestampAttribute;
+
+    protected Object table2Array;
 
     public void setDateAttribute(LocalDate dateAttribute) {
-        writeProperty("dateAttribute", dateAttribute);
+        beforePropertyWrite("dateAttribute", this.dateAttribute, dateAttribute);
+        this.dateAttribute = dateAttribute;
     }
+
     public LocalDate getDateAttribute() {
-        return (LocalDate)readProperty("dateAttribute");
+        beforePropertyRead("dateAttribute");
+        return this.dateAttribute;
     }
 
     public void setGlobalAttribute(String globalAttribute) {
-        writeProperty("globalAttribute", globalAttribute);
+        beforePropertyWrite("globalAttribute", this.globalAttribute, globalAttribute);
+        this.globalAttribute = globalAttribute;
     }
+
     public String getGlobalAttribute() {
-        return (String)readProperty("globalAttribute");
+        beforePropertyRead("globalAttribute");
+        return this.globalAttribute;
     }
 
     public void setOldDateAttribute(Date oldDateAttribute) {
-        writeProperty("oldDateAttribute", oldDateAttribute);
+        beforePropertyWrite("oldDateAttribute", this.oldDateAttribute, oldDateAttribute);
+        this.oldDateAttribute = oldDateAttribute;
     }
+
     public Date getOldDateAttribute() {
-        return (Date)readProperty("oldDateAttribute");
+        beforePropertyRead("oldDateAttribute");
+        return this.oldDateAttribute;
     }
 
     public void setServerAttribute(String serverAttribute) {
-        writeProperty("serverAttribute", serverAttribute);
+        beforePropertyWrite("serverAttribute", this.serverAttribute, serverAttribute);
+        this.serverAttribute = serverAttribute;
     }
+
     public String getServerAttribute() {
-        return (String)readProperty("serverAttribute");
+        beforePropertyRead("serverAttribute");
+        return this.serverAttribute;
     }
 
     public void setTimeAttribute(LocalTime timeAttribute) {
-        writeProperty("timeAttribute", timeAttribute);
+        beforePropertyWrite("timeAttribute", this.timeAttribute, timeAttribute);
+        this.timeAttribute = timeAttribute;
     }
+
     public LocalTime getTimeAttribute() {
-        return (LocalTime)readProperty("timeAttribute");
+        beforePropertyRead("timeAttribute");
+        return this.timeAttribute;
     }
 
     public void setTimestampAttribute(LocalDateTime timestampAttribute) {
-        writeProperty("timestampAttribute", timestampAttribute);
+        beforePropertyWrite("timestampAttribute", this.timestampAttribute, timestampAttribute);
+        this.timestampAttribute = timestampAttribute;
     }
+
     public LocalDateTime getTimestampAttribute() {
-        return (LocalDateTime)readProperty("timestampAttribute");
+        beforePropertyRead("timestampAttribute");
+        return this.timestampAttribute;
     }
 
     public void addToTable2Array(MtTable2 obj) {
         addToManyTarget("table2Array", obj, true);
     }
+
     public void removeFromTable2Array(MtTable2 obj) {
         removeToManyTarget("table2Array", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<MtTable2> getTable2Array() {
         return (List<MtTable2>)readProperty("table2Array");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "dateAttribute":
+                return this.dateAttribute;
+            case "globalAttribute":
+                return this.globalAttribute;
+            case "oldDateAttribute":
+                return this.oldDateAttribute;
+            case "serverAttribute":
+                return this.serverAttribute;
+            case "timeAttribute":
+                return this.timeAttribute;
+            case "timestampAttribute":
+                return this.timestampAttribute;
+            case "table2Array":
+                return this.table2Array;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "dateAttribute":
+                this.dateAttribute = (LocalDate)val;
+                break;
+            case "globalAttribute":
+                this.globalAttribute = (String)val;
+                break;
+            case "oldDateAttribute":
+                this.oldDateAttribute = (Date)val;
+                break;
+            case "serverAttribute":
+                this.serverAttribute = (String)val;
+                break;
+            case "timeAttribute":
+                this.timeAttribute = (LocalTime)val;
+                break;
+            case "timestampAttribute":
+                this.timestampAttribute = (LocalDateTime)val;
+                break;
+            case "table2Array":
+                this.table2Array = 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(this.dateAttribute);
+        out.writeObject(this.globalAttribute);
+        out.writeObject(this.oldDateAttribute);
+        out.writeObject(this.serverAttribute);
+        out.writeObject(this.timeAttribute);
+        out.writeObject(this.timestampAttribute);
+        out.writeObject(this.table2Array);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.dateAttribute = (LocalDate)in.readObject();
+        this.globalAttribute = (String)in.readObject();
+        this.oldDateAttribute = (Date)in.readObject();
+        this.serverAttribute = (String)in.readObject();
+        this.timeAttribute = (LocalTime)in.readObject();
+        this.timestampAttribute = (LocalDateTime)in.readObject();
+        this.table2Array = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cca2445/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java
----------------------------------------------------------------------
diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java
index 68ab205..3e3ec94 100644
--- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java
+++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_MtTable2.java
@@ -1,7 +1,13 @@
 package org.apache.cayenne.rop.protostuff.persistent.auto;
 
-import org.apache.cayenne.CayenneDataObject;
-import org.apache.cayenne.exp.Property;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.cayenne.BaseDataObject;
+import org.apache.cayenne.exp.property.EntityProperty;
+import org.apache.cayenne.exp.property.PropertyFactory;
+import org.apache.cayenne.exp.property.StringProperty;
 import org.apache.cayenne.rop.protostuff.persistent.MtTable1;
 
 /**
@@ -10,20 +16,27 @@ import org.apache.cayenne.rop.protostuff.persistent.MtTable1;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _MtTable2 extends CayenneDataObject {
+public abstract class _MtTable2 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
     public static final String TABLE2_ID_PK_COLUMN = "TABLE2_ID";
 
-    public static final Property<String> GLOBAL_ATTRIBUTE = Property.create("globalAttribute", String.class);
-    public static final Property<MtTable1> TABLE1 = Property.create("table1", MtTable1.class);
+    public static final StringProperty<String> GLOBAL_ATTRIBUTE = PropertyFactory.createString("globalAttribute", String.class);
+    public static final EntityProperty<MtTable1> TABLE1 = PropertyFactory.createEntity("table1", MtTable1.class);
+
+    protected String globalAttribute;
+
+    protected Object table1;
 
     public void setGlobalAttribute(String globalAttribute) {
-        writeProperty("globalAttribute", globalAttribute);
+        beforePropertyWrite("globalAttribute", this.globalAttribute, globalAttribute);
+        this.globalAttribute = globalAttribute;
     }
+
     public String getGlobalAttribute() {
-        return (String)readProperty("globalAttribute");
+        beforePropertyRead("globalAttribute");
+        return this.globalAttribute;
     }
 
     public void setTable1(MtTable1 table1) {
@@ -34,5 +47,60 @@ public abstract class _MtTable2 extends CayenneDataObject {
         return (MtTable1)readProperty("table1");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "globalAttribute":
+                return this.globalAttribute;
+            case "table1":
+                return this.table1;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "globalAttribute":
+                this.globalAttribute = (String)val;
+                break;
+            case "table1":
+                this.table1 = 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(this.globalAttribute);
+        out.writeObject(this.table1);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        this.globalAttribute = (String)in.readObject();
+        this.table1 = in.readObject();
+    }
 
 }


Mime
View raw message