cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [02/18] cayenne git commit: CAY-2330 Field based data objects
Date Fri, 11 Aug 2017 07:54:39 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/soft_delete/auto/_SoftDelete.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/soft_delete/auto/_SoftDelete.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/soft_delete/auto/_SoftDelete.java
index b2ce235..fd8c22a 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/soft_delete/auto/_SoftDelete.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/soft_delete/auto/_SoftDelete.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.soft_delete.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 _SoftDelete extends CayenneDataObject {
+public abstract class _SoftDelete extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,20 +22,86 @@ public abstract class _SoftDelete extends CayenneDataObject {
     public static final Property<Boolean> DELETED = Property.create("deleted", Boolean.class);
     public static final Property<String> NAME = Property.create("name", String.class);
 
+    protected Boolean deleted;
+    protected String name;
+
+
     public void setDeleted(Boolean deleted) {
-        writeProperty("deleted", deleted);
+        beforePropertyWrite("deleted", this.deleted, deleted);
+        this.deleted = deleted;
     }
+
     public Boolean getDeleted() {
-        return (Boolean)readProperty("deleted");
+        beforePropertyRead("deleted");
+        return deleted;
     }
 
     public void setName(String name) {
-        writeProperty("name", name);
+        beforePropertyWrite("name", this.name, name);
+        this.name = name;
     }
+
     public String getName() {
-        return (String)readProperty("name");
+        beforePropertyRead("name");
+        return name;
     }
 
-    protected abstract void onPrePersist();
+protected abstract void onPrePersist();
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "deleted":
+                return this.deleted;
+            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 "deleted":
+                this.deleted = (Boolean)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(deleted);
+        out.writeObject(name);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        deleted = (Boolean)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/table_primitives/auto/_TablePrimitives.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/table_primitives/auto/_TablePrimitives.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/table_primitives/auto/_TablePrimitives.java
index 2f660af..50fcda0 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/table_primitives/auto/_TablePrimitives.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/table_primitives/auto/_TablePrimitives.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.table_primitives.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 _TablePrimitives extends CayenneDataObject {
+public abstract class _TablePrimitives extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,20 +22,84 @@ public abstract class _TablePrimitives extends CayenneDataObject {
     public static final Property<Boolean> BOOLEAN_COLUMN = Property.create("booleanColumn", Boolean.class);
     public static final Property<Integer> INT_COLUMN = Property.create("intColumn", Integer.class);
 
+    protected boolean booleanColumn;
+    protected int intColumn;
+
+
     public void setBooleanColumn(boolean booleanColumn) {
-        writeProperty("booleanColumn", booleanColumn);
+        beforePropertyWrite("booleanColumn", this.booleanColumn, booleanColumn);
+        this.booleanColumn = booleanColumn;
     }
+
 	public boolean isBooleanColumn() {
-        Boolean value = (Boolean)readProperty("booleanColumn");
-        return (value != null) ? value.booleanValue() : false;
+        beforePropertyRead("booleanColumn");
+        return booleanColumn;
     }
 
     public void setIntColumn(int intColumn) {
-        writeProperty("intColumn", intColumn);
+        beforePropertyWrite("intColumn", this.intColumn, intColumn);
+        this.intColumn = intColumn;
     }
+
     public int getIntColumn() {
-        Object value = readProperty("intColumn");
-        return (value != null) ? (Integer) value : 0;
+        beforePropertyRead("intColumn");
+        return intColumn;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "booleanColumn":
+                return this.booleanColumn;
+            case "intColumn":
+                return this.intColumn;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "booleanColumn":
+                this.booleanColumn = val == null ? false : (Boolean)val;
+                break;
+            case "intColumn":
+                this.intColumn = val == null ? 0 : (Integer)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.writeBoolean(booleanColumn);
+        out.writeInt(intColumn);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        booleanColumn = in.readBoolean();
+        intColumn = in.readInt();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtGroup.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtGroup.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtGroup.java
index bcd5a10..7d5ab3a 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtGroup.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtGroup.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.testmap.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.testmap.ArtGroup;
 import org.apache.cayenne.testdo.testmap.Artist;
@@ -13,7 +16,7 @@ import org.apache.cayenne.testdo.testmap.Artist;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ArtGroup extends CayenneDataObject {
+public abstract class _ArtGroup extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -24,37 +27,48 @@ public abstract class _ArtGroup extends CayenneDataObject {
     public static final Property<List<ArtGroup>> CHILD_GROUPS_ARRAY = Property.create("childGroupsArray", List.class);
     public static final Property<ArtGroup> TO_PARENT_GROUP = Property.create("toParentGroup", ArtGroup.class);
 
+    protected String name;
+
+    protected Object artistArray;
+    protected Object childGroupsArray;
+    protected Object toParentGroup;
+
     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 addToArtistArray(Artist obj) {
         addToManyTarget("artistArray", obj, true);
     }
+
     public void removeFromArtistArray(Artist obj) {
         removeToManyTarget("artistArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Artist> getArtistArray() {
         return (List<Artist>)readProperty("artistArray");
     }
 
-
     public void addToChildGroupsArray(ArtGroup obj) {
         addToManyTarget("childGroupsArray", obj, true);
     }
+
     public void removeFromChildGroupsArray(ArtGroup obj) {
         removeToManyTarget("childGroupsArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ArtGroup> getChildGroupsArray() {
         return (List<ArtGroup>)readProperty("childGroupsArray");
     }
 
-
     public void setToParentGroup(ArtGroup toParentGroup) {
         setToOneTarget("toParentGroup", toParentGroup, true);
     }
@@ -63,5 +77,74 @@ public abstract class _ArtGroup extends CayenneDataObject {
         return (ArtGroup)readProperty("toParentGroup");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "artistArray":
+                return this.artistArray;
+            case "childGroupsArray":
+                return this.childGroupsArray;
+            case "toParentGroup":
+                return this.toParentGroup;
+            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 "artistArray":
+                this.artistArray = val;
+                break;
+            case "childGroupsArray":
+                this.childGroupsArray = val;
+                break;
+            case "toParentGroup":
+                this.toParentGroup = 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(artistArray);
+        out.writeObject(childGroupsArray);
+        out.writeObject(toParentGroup);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        artistArray = in.readObject();
+        childGroupsArray = in.readObject();
+        toParentGroup = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Artist.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Artist.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Artist.java
index 854e6fd..e14eaf5 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Artist.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Artist.java
@@ -1,9 +1,12 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Date;
 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.testmap.ArtGroup;
 import org.apache.cayenne.testdo.testmap.ArtistExhibit;
@@ -15,7 +18,7 @@ import org.apache.cayenne.testdo.testmap.Painting;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Artist extends CayenneDataObject {
+public abstract class _Artist extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -27,54 +30,147 @@ public abstract class _Artist extends CayenneDataObject {
     public static final Property<List<ArtGroup>> GROUP_ARRAY = Property.create("groupArray", List.class);
     public static final Property<List<Painting>> PAINTING_ARRAY = Property.create("paintingArray", List.class);
 
+    protected String artistName;
+    protected Date dateOfBirth;
+
+    protected Object artistExhibitArray;
+    protected Object groupArray;
+    protected Object paintingArray;
+
     public void setArtistName(String artistName) {
-        writeProperty("artistName", artistName);
+        beforePropertyWrite("artistName", this.artistName, artistName);
+        this.artistName = artistName;
     }
+
     public String getArtistName() {
-        return (String)readProperty("artistName");
+        beforePropertyRead("artistName");
+        return artistName;
     }
 
     public void setDateOfBirth(Date dateOfBirth) {
-        writeProperty("dateOfBirth", dateOfBirth);
+        beforePropertyWrite("dateOfBirth", this.dateOfBirth, dateOfBirth);
+        this.dateOfBirth = dateOfBirth;
     }
+
     public Date getDateOfBirth() {
-        return (Date)readProperty("dateOfBirth");
+        beforePropertyRead("dateOfBirth");
+        return dateOfBirth;
     }
 
     public void addToArtistExhibitArray(ArtistExhibit obj) {
         addToManyTarget("artistExhibitArray", obj, true);
     }
+
     public void removeFromArtistExhibitArray(ArtistExhibit obj) {
         removeToManyTarget("artistExhibitArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ArtistExhibit> getArtistExhibitArray() {
         return (List<ArtistExhibit>)readProperty("artistExhibitArray");
     }
 
-
     public void addToGroupArray(ArtGroup obj) {
         addToManyTarget("groupArray", obj, true);
     }
+
     public void removeFromGroupArray(ArtGroup obj) {
         removeToManyTarget("groupArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ArtGroup> getGroupArray() {
         return (List<ArtGroup>)readProperty("groupArray");
     }
 
-
     public void addToPaintingArray(Painting obj) {
         addToManyTarget("paintingArray", obj, true);
     }
+
     public void removeFromPaintingArray(Painting obj) {
         removeToManyTarget("paintingArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Painting> getPaintingArray() {
         return (List<Painting>)readProperty("paintingArray");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "artistName":
+                return this.artistName;
+            case "dateOfBirth":
+                return this.dateOfBirth;
+            case "artistExhibitArray":
+                return this.artistExhibitArray;
+            case "groupArray":
+                return this.groupArray;
+            case "paintingArray":
+                return this.paintingArray;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "artistName":
+                this.artistName = (String)val;
+                break;
+            case "dateOfBirth":
+                this.dateOfBirth = (Date)val;
+                break;
+            case "artistExhibitArray":
+                this.artistExhibitArray = val;
+                break;
+            case "groupArray":
+                this.groupArray = val;
+                break;
+            case "paintingArray":
+                this.paintingArray = 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(artistName);
+        out.writeObject(dateOfBirth);
+        out.writeObject(artistExhibitArray);
+        out.writeObject(groupArray);
+        out.writeObject(paintingArray);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        artistName = (String)in.readObject();
+        dateOfBirth = (Date)in.readObject();
+        artistExhibitArray = in.readObject();
+        groupArray = in.readObject();
+        paintingArray = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistCallback.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistCallback.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistCallback.java
index 14caad5..c050e37 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistCallback.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistCallback.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Date;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 
 /**
@@ -11,7 +14,7 @@ import org.apache.cayenne.exp.Property;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ArtistCallback extends CayenneDataObject {
+public abstract class _ArtistCallback extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,32 +23,98 @@ public abstract class _ArtistCallback extends CayenneDataObject {
     public static final Property<String> ARTIST_NAME = Property.create("artistName", String.class);
     public static final Property<Date> DATE_OF_BIRTH = Property.create("dateOfBirth", Date.class);
 
+    protected String artistName;
+    protected Date dateOfBirth;
+
+
     public void setArtistName(String artistName) {
-        writeProperty("artistName", artistName);
+        beforePropertyWrite("artistName", this.artistName, artistName);
+        this.artistName = artistName;
     }
+
     public String getArtistName() {
-        return (String)readProperty("artistName");
+        beforePropertyRead("artistName");
+        return artistName;
     }
 
     public void setDateOfBirth(Date dateOfBirth) {
-        writeProperty("dateOfBirth", dateOfBirth);
+        beforePropertyWrite("dateOfBirth", this.dateOfBirth, dateOfBirth);
+        this.dateOfBirth = dateOfBirth;
     }
+
     public Date getDateOfBirth() {
-        return (Date)readProperty("dateOfBirth");
+        beforePropertyRead("dateOfBirth");
+        return dateOfBirth;
     }
 
-    protected abstract void prePersistEntityObjEntity();
+protected abstract void prePersistEntityObjEntity();
+
+protected abstract void preRemoveEntityObjEntity();
 
-    protected abstract void preRemoveEntityObjEntity();
+protected abstract void preUpdateEntityObjEntity();
 
-    protected abstract void preUpdateEntityObjEntity();
+protected abstract void postPersistEntityObjEntity();
 
-    protected abstract void postPersistEntityObjEntity();
+protected abstract void postRemoveEntityObjEntity();
 
-    protected abstract void postRemoveEntityObjEntity();
+protected abstract void postUpdateEntityObjEntity();
 
-    protected abstract void postUpdateEntityObjEntity();
+protected abstract void postLoadEntityObjEntity();
 
-    protected abstract void postLoadEntityObjEntity();
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "artistName":
+                return this.artistName;
+            case "dateOfBirth":
+                return this.dateOfBirth;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "artistName":
+                this.artistName = (String)val;
+                break;
+            case "dateOfBirth":
+                this.dateOfBirth = (Date)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(artistName);
+        out.writeObject(dateOfBirth);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        artistName = (String)in.readObject();
+        dateOfBirth = (Date)in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistExhibit.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistExhibit.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistExhibit.java
index 73a528a..6e5be90 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistExhibit.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ArtistExhibit.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.testmap.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.testmap.Artist;
 import org.apache.cayenne.testdo.testmap.Exhibit;
@@ -11,7 +15,7 @@ import org.apache.cayenne.testdo.testmap.Exhibit;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ArtistExhibit extends CayenneDataObject {
+public abstract class _ArtistExhibit extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -21,6 +25,10 @@ public abstract class _ArtistExhibit extends CayenneDataObject {
     public static final Property<Artist> TO_ARTIST = Property.create("toArtist", Artist.class);
     public static final Property<Exhibit> TO_EXHIBIT = Property.create("toExhibit", Exhibit.class);
 
+
+    protected Object toArtist;
+    protected Object toExhibit;
+
     public void setToArtist(Artist toArtist) {
         setToOneTarget("toArtist", toArtist, true);
     }
@@ -29,7 +37,6 @@ public abstract class _ArtistExhibit extends CayenneDataObject {
         return (Artist)readProperty("toArtist");
     }
 
-
     public void setToExhibit(Exhibit toExhibit) {
         setToOneTarget("toExhibit", toExhibit, true);
     }
@@ -38,5 +45,60 @@ public abstract class _ArtistExhibit extends CayenneDataObject {
         return (Exhibit)readProperty("toExhibit");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "toArtist":
+                return this.toArtist;
+            case "toExhibit":
+                return this.toExhibit;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "toArtist":
+                this.toArtist = val;
+                break;
+            case "toExhibit":
+                this.toExhibit = 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(toArtist);
+        out.writeObject(toExhibit);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        toArtist = in.readObject();
+        toExhibit = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPainting.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPainting.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPainting.java
index 3263470..ddf4c00 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPainting.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPainting.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.math.BigDecimal;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.apache.cayenne.testdo.testmap.Gallery;
@@ -14,7 +17,7 @@ import org.apache.cayenne.testdo.testmap.PaintingInfo;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _CompoundPainting extends CayenneDataObject {
+public abstract class _CompoundPainting extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -29,39 +32,64 @@ public abstract class _CompoundPainting extends CayenneDataObject {
     public static final Property<Gallery> TO_GALLERY = Property.create("toGallery", Gallery.class);
     public static final Property<PaintingInfo> TO_PAINTING_INFO = Property.create("toPaintingInfo", PaintingInfo.class);
 
+    protected String artistName;
+    protected BigDecimal estimatedPrice;
+    protected String galleryName;
+    protected String paintingTitle;
+    protected String textReview;
+
+    protected Object toArtist;
+    protected Object toGallery;
+    protected Object toPaintingInfo;
+
     public void setArtistName(String artistName) {
-        writeProperty("artistName", artistName);
+        beforePropertyWrite("artistName", this.artistName, artistName);
+        this.artistName = artistName;
     }
+
     public String getArtistName() {
-        return (String)readProperty("artistName");
+        beforePropertyRead("artistName");
+        return artistName;
     }
 
     public void setEstimatedPrice(BigDecimal estimatedPrice) {
-        writeProperty("estimatedPrice", estimatedPrice);
+        beforePropertyWrite("estimatedPrice", this.estimatedPrice, estimatedPrice);
+        this.estimatedPrice = estimatedPrice;
     }
+
     public BigDecimal getEstimatedPrice() {
-        return (BigDecimal)readProperty("estimatedPrice");
+        beforePropertyRead("estimatedPrice");
+        return estimatedPrice;
     }
 
     public void setGalleryName(String galleryName) {
-        writeProperty("galleryName", galleryName);
+        beforePropertyWrite("galleryName", this.galleryName, galleryName);
+        this.galleryName = galleryName;
     }
+
     public String getGalleryName() {
-        return (String)readProperty("galleryName");
+        beforePropertyRead("galleryName");
+        return galleryName;
     }
 
     public void setPaintingTitle(String paintingTitle) {
-        writeProperty("paintingTitle", paintingTitle);
+        beforePropertyWrite("paintingTitle", this.paintingTitle, paintingTitle);
+        this.paintingTitle = paintingTitle;
     }
+
     public String getPaintingTitle() {
-        return (String)readProperty("paintingTitle");
+        beforePropertyRead("paintingTitle");
+        return paintingTitle;
     }
 
     public void setTextReview(String textReview) {
-        writeProperty("textReview", textReview);
+        beforePropertyWrite("textReview", this.textReview, textReview);
+        this.textReview = textReview;
     }
+
     public String getTextReview() {
-        return (String)readProperty("textReview");
+        beforePropertyRead("textReview");
+        return textReview;
     }
 
     public void setToArtist(Artist toArtist) {
@@ -72,7 +100,6 @@ public abstract class _CompoundPainting extends CayenneDataObject {
         return (Artist)readProperty("toArtist");
     }
 
-
     public void setToGallery(Gallery toGallery) {
         setToOneTarget("toGallery", toGallery, true);
     }
@@ -81,7 +108,6 @@ public abstract class _CompoundPainting extends CayenneDataObject {
         return (Gallery)readProperty("toGallery");
     }
 
-
     public void setToPaintingInfo(PaintingInfo toPaintingInfo) {
         setToOneTarget("toPaintingInfo", toPaintingInfo, true);
     }
@@ -90,5 +116,102 @@ public abstract class _CompoundPainting extends CayenneDataObject {
         return (PaintingInfo)readProperty("toPaintingInfo");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "artistName":
+                return this.artistName;
+            case "estimatedPrice":
+                return this.estimatedPrice;
+            case "galleryName":
+                return this.galleryName;
+            case "paintingTitle":
+                return this.paintingTitle;
+            case "textReview":
+                return this.textReview;
+            case "toArtist":
+                return this.toArtist;
+            case "toGallery":
+                return this.toGallery;
+            case "toPaintingInfo":
+                return this.toPaintingInfo;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "artistName":
+                this.artistName = (String)val;
+                break;
+            case "estimatedPrice":
+                this.estimatedPrice = (BigDecimal)val;
+                break;
+            case "galleryName":
+                this.galleryName = (String)val;
+                break;
+            case "paintingTitle":
+                this.paintingTitle = (String)val;
+                break;
+            case "textReview":
+                this.textReview = (String)val;
+                break;
+            case "toArtist":
+                this.toArtist = val;
+                break;
+            case "toGallery":
+                this.toGallery = val;
+                break;
+            case "toPaintingInfo":
+                this.toPaintingInfo = 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(artistName);
+        out.writeObject(estimatedPrice);
+        out.writeObject(galleryName);
+        out.writeObject(paintingTitle);
+        out.writeObject(textReview);
+        out.writeObject(toArtist);
+        out.writeObject(toGallery);
+        out.writeObject(toPaintingInfo);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        artistName = (String)in.readObject();
+        estimatedPrice = (BigDecimal)in.readObject();
+        galleryName = (String)in.readObject();
+        paintingTitle = (String)in.readObject();
+        textReview = (String)in.readObject();
+        toArtist = in.readObject();
+        toGallery = in.readObject();
+        toPaintingInfo = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPaintingLongNames.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPaintingLongNames.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPaintingLongNames.java
index 62825dd..fd372f1 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPaintingLongNames.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_CompoundPaintingLongNames.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.math.BigDecimal;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.apache.cayenne.testdo.testmap.Gallery;
@@ -15,7 +18,7 @@ import org.apache.cayenne.testdo.testmap.ROArtist;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _CompoundPaintingLongNames extends CayenneDataObject {
+public abstract class _CompoundPaintingLongNames extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -32,46 +35,76 @@ public abstract class _CompoundPaintingLongNames extends CayenneDataObject {
     public static final Property<Gallery> TO_GALLERY = Property.create("toGallery", Gallery.class);
     public static final Property<PaintingInfo> TO_PAINTING_INFO = Property.create("toPaintingInfo", PaintingInfo.class);
 
+    protected String artistLongName;
+    protected BigDecimal estimatedPrice;
+    protected String galleryLongName;
+    protected String paintingDescription;
+    protected String paintingTitle;
+    protected String textLongReview;
+
+    protected Object toArtist;
+    protected Object toArtist1;
+    protected Object toGallery;
+    protected Object toPaintingInfo;
+
     public void setArtistLongName(String artistLongName) {
-        writeProperty("artistLongName", artistLongName);
+        beforePropertyWrite("artistLongName", this.artistLongName, artistLongName);
+        this.artistLongName = artistLongName;
     }
+
     public String getArtistLongName() {
-        return (String)readProperty("artistLongName");
+        beforePropertyRead("artistLongName");
+        return artistLongName;
     }
 
     public void setEstimatedPrice(BigDecimal estimatedPrice) {
-        writeProperty("estimatedPrice", estimatedPrice);
+        beforePropertyWrite("estimatedPrice", this.estimatedPrice, estimatedPrice);
+        this.estimatedPrice = estimatedPrice;
     }
+
     public BigDecimal getEstimatedPrice() {
-        return (BigDecimal)readProperty("estimatedPrice");
+        beforePropertyRead("estimatedPrice");
+        return estimatedPrice;
     }
 
     public void setGalleryLongName(String galleryLongName) {
-        writeProperty("galleryLongName", galleryLongName);
+        beforePropertyWrite("galleryLongName", this.galleryLongName, galleryLongName);
+        this.galleryLongName = galleryLongName;
     }
+
     public String getGalleryLongName() {
-        return (String)readProperty("galleryLongName");
+        beforePropertyRead("galleryLongName");
+        return galleryLongName;
     }
 
     public void setPaintingDescription(String paintingDescription) {
-        writeProperty("paintingDescription", paintingDescription);
+        beforePropertyWrite("paintingDescription", this.paintingDescription, paintingDescription);
+        this.paintingDescription = paintingDescription;
     }
+
     public String getPaintingDescription() {
-        return (String)readProperty("paintingDescription");
+        beforePropertyRead("paintingDescription");
+        return paintingDescription;
     }
 
     public void setPaintingTitle(String paintingTitle) {
-        writeProperty("paintingTitle", paintingTitle);
+        beforePropertyWrite("paintingTitle", this.paintingTitle, paintingTitle);
+        this.paintingTitle = paintingTitle;
     }
+
     public String getPaintingTitle() {
-        return (String)readProperty("paintingTitle");
+        beforePropertyRead("paintingTitle");
+        return paintingTitle;
     }
 
     public void setTextLongReview(String textLongReview) {
-        writeProperty("textLongReview", textLongReview);
+        beforePropertyWrite("textLongReview", this.textLongReview, textLongReview);
+        this.textLongReview = textLongReview;
     }
+
     public String getTextLongReview() {
-        return (String)readProperty("textLongReview");
+        beforePropertyRead("textLongReview");
+        return textLongReview;
     }
 
     public void setToArtist(Artist toArtist) {
@@ -82,7 +115,6 @@ public abstract class _CompoundPaintingLongNames extends CayenneDataObject {
         return (Artist)readProperty("toArtist");
     }
 
-
     public void setToArtist1(ROArtist toArtist1) {
         setToOneTarget("toArtist1", toArtist1, true);
     }
@@ -91,7 +123,6 @@ public abstract class _CompoundPaintingLongNames extends CayenneDataObject {
         return (ROArtist)readProperty("toArtist1");
     }
 
-
     public void setToGallery(Gallery toGallery) {
         setToOneTarget("toGallery", toGallery, true);
     }
@@ -100,7 +131,6 @@ public abstract class _CompoundPaintingLongNames extends CayenneDataObject {
         return (Gallery)readProperty("toGallery");
     }
 
-
     public void setToPaintingInfo(PaintingInfo toPaintingInfo) {
         setToOneTarget("toPaintingInfo", toPaintingInfo, true);
     }
@@ -109,5 +139,116 @@ public abstract class _CompoundPaintingLongNames extends CayenneDataObject {
         return (PaintingInfo)readProperty("toPaintingInfo");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "artistLongName":
+                return this.artistLongName;
+            case "estimatedPrice":
+                return this.estimatedPrice;
+            case "galleryLongName":
+                return this.galleryLongName;
+            case "paintingDescription":
+                return this.paintingDescription;
+            case "paintingTitle":
+                return this.paintingTitle;
+            case "textLongReview":
+                return this.textLongReview;
+            case "toArtist":
+                return this.toArtist;
+            case "toArtist1":
+                return this.toArtist1;
+            case "toGallery":
+                return this.toGallery;
+            case "toPaintingInfo":
+                return this.toPaintingInfo;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "artistLongName":
+                this.artistLongName = (String)val;
+                break;
+            case "estimatedPrice":
+                this.estimatedPrice = (BigDecimal)val;
+                break;
+            case "galleryLongName":
+                this.galleryLongName = (String)val;
+                break;
+            case "paintingDescription":
+                this.paintingDescription = (String)val;
+                break;
+            case "paintingTitle":
+                this.paintingTitle = (String)val;
+                break;
+            case "textLongReview":
+                this.textLongReview = (String)val;
+                break;
+            case "toArtist":
+                this.toArtist = val;
+                break;
+            case "toArtist1":
+                this.toArtist1 = val;
+                break;
+            case "toGallery":
+                this.toGallery = val;
+                break;
+            case "toPaintingInfo":
+                this.toPaintingInfo = 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(artistLongName);
+        out.writeObject(estimatedPrice);
+        out.writeObject(galleryLongName);
+        out.writeObject(paintingDescription);
+        out.writeObject(paintingTitle);
+        out.writeObject(textLongReview);
+        out.writeObject(toArtist);
+        out.writeObject(toArtist1);
+        out.writeObject(toGallery);
+        out.writeObject(toPaintingInfo);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        artistLongName = (String)in.readObject();
+        estimatedPrice = (BigDecimal)in.readObject();
+        galleryLongName = (String)in.readObject();
+        paintingDescription = (String)in.readObject();
+        paintingTitle = (String)in.readObject();
+        textLongReview = (String)in.readObject();
+        toArtist = in.readObject();
+        toArtist1 = in.readObject();
+        toGallery = in.readObject();
+        toPaintingInfo = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Exhibit.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Exhibit.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Exhibit.java
index 00a8b29..e77fc16 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Exhibit.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Exhibit.java
@@ -1,9 +1,12 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Date;
 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.testmap.ArtistExhibit;
 import org.apache.cayenne.testdo.testmap.Gallery;
@@ -14,7 +17,7 @@ import org.apache.cayenne.testdo.testmap.Gallery;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Exhibit extends CayenneDataObject {
+public abstract class _Exhibit extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -25,32 +28,45 @@ public abstract class _Exhibit extends CayenneDataObject {
     public static final Property<List<ArtistExhibit>> ARTIST_EXHIBIT_ARRAY = Property.create("artistExhibitArray", List.class);
     public static final Property<Gallery> TO_GALLERY = Property.create("toGallery", Gallery.class);
 
+    protected Date closingDate;
+    protected Date openingDate;
+
+    protected Object artistExhibitArray;
+    protected Object toGallery;
+
     public void setClosingDate(Date closingDate) {
-        writeProperty("closingDate", closingDate);
+        beforePropertyWrite("closingDate", this.closingDate, closingDate);
+        this.closingDate = closingDate;
     }
+
     public Date getClosingDate() {
-        return (Date)readProperty("closingDate");
+        beforePropertyRead("closingDate");
+        return closingDate;
     }
 
     public void setOpeningDate(Date openingDate) {
-        writeProperty("openingDate", openingDate);
+        beforePropertyWrite("openingDate", this.openingDate, openingDate);
+        this.openingDate = openingDate;
     }
+
     public Date getOpeningDate() {
-        return (Date)readProperty("openingDate");
+        beforePropertyRead("openingDate");
+        return openingDate;
     }
 
     public void addToArtistExhibitArray(ArtistExhibit obj) {
         addToManyTarget("artistExhibitArray", obj, true);
     }
+
     public void removeFromArtistExhibitArray(ArtistExhibit obj) {
         removeToManyTarget("artistExhibitArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<ArtistExhibit> getArtistExhibitArray() {
         return (List<ArtistExhibit>)readProperty("artistExhibitArray");
     }
 
-
     public void setToGallery(Gallery toGallery) {
         setToOneTarget("toGallery", toGallery, true);
     }
@@ -59,5 +75,74 @@ public abstract class _Exhibit extends CayenneDataObject {
         return (Gallery)readProperty("toGallery");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "closingDate":
+                return this.closingDate;
+            case "openingDate":
+                return this.openingDate;
+            case "artistExhibitArray":
+                return this.artistExhibitArray;
+            case "toGallery":
+                return this.toGallery;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "closingDate":
+                this.closingDate = (Date)val;
+                break;
+            case "openingDate":
+                this.openingDate = (Date)val;
+                break;
+            case "artistExhibitArray":
+                this.artistExhibitArray = val;
+                break;
+            case "toGallery":
+                this.toGallery = 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(closingDate);
+        out.writeObject(openingDate);
+        out.writeObject(artistExhibitArray);
+        out.writeObject(toGallery);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        closingDate = (Date)in.readObject();
+        openingDate = (Date)in.readObject();
+        artistExhibitArray = in.readObject();
+        toGallery = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Gallery.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Gallery.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Gallery.java
index 73bf5a2..f462a9b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Gallery.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Gallery.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.testmap.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.testmap.Exhibit;
 import org.apache.cayenne.testdo.testmap.Painting;
@@ -13,7 +16,7 @@ import org.apache.cayenne.testdo.testmap.Painting;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Gallery extends CayenneDataObject {
+public abstract class _Gallery extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -23,35 +26,108 @@ public abstract class _Gallery extends CayenneDataObject {
     public static final Property<List<Exhibit>> EXHIBIT_ARRAY = Property.create("exhibitArray", List.class);
     public static final Property<List<Painting>> PAINTING_ARRAY = Property.create("paintingArray", List.class);
 
+    protected String galleryName;
+
+    protected Object exhibitArray;
+    protected Object paintingArray;
+
     public void setGalleryName(String galleryName) {
-        writeProperty("galleryName", galleryName);
+        beforePropertyWrite("galleryName", this.galleryName, galleryName);
+        this.galleryName = galleryName;
     }
+
     public String getGalleryName() {
-        return (String)readProperty("galleryName");
+        beforePropertyRead("galleryName");
+        return galleryName;
     }
 
     public void addToExhibitArray(Exhibit obj) {
         addToManyTarget("exhibitArray", obj, true);
     }
+
     public void removeFromExhibitArray(Exhibit obj) {
         removeToManyTarget("exhibitArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Exhibit> getExhibitArray() {
         return (List<Exhibit>)readProperty("exhibitArray");
     }
 
-
     public void addToPaintingArray(Painting obj) {
         addToManyTarget("paintingArray", obj, true);
     }
+
     public void removeFromPaintingArray(Painting obj) {
         removeToManyTarget("paintingArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Painting> getPaintingArray() {
         return (List<Painting>)readProperty("paintingArray");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "galleryName":
+                return this.galleryName;
+            case "exhibitArray":
+                return this.exhibitArray;
+            case "paintingArray":
+                return this.paintingArray;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "galleryName":
+                this.galleryName = (String)val;
+                break;
+            case "exhibitArray":
+                this.exhibitArray = val;
+                break;
+            case "paintingArray":
+                this.paintingArray = 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(galleryName);
+        out.writeObject(exhibitArray);
+        out.writeObject(paintingArray);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        galleryName = (String)in.readObject();
+        exhibitArray = in.readObject();
+        paintingArray = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_MeaningfulGeneratedColumnTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_MeaningfulGeneratedColumnTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_MeaningfulGeneratedColumnTestEntity.java
index 77ff7bf..274a141 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_MeaningfulGeneratedColumnTestEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_MeaningfulGeneratedColumnTestEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.testmap.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 _MeaningfulGeneratedColumnTestEntity extends CayenneDataObject {
+public abstract class _MeaningfulGeneratedColumnTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -18,18 +22,84 @@ public abstract class _MeaningfulGeneratedColumnTestEntity extends CayenneDataOb
     public static final Property<Integer> GENERATED_COLUMN = Property.create("generatedColumn", Integer.class);
     public static final Property<String> NAME = Property.create("name", String.class);
 
+    protected Integer generatedColumn;
+    protected String name;
+
+
     public void setGeneratedColumn(Integer generatedColumn) {
-        writeProperty("generatedColumn", generatedColumn);
+        beforePropertyWrite("generatedColumn", this.generatedColumn, generatedColumn);
+        this.generatedColumn = generatedColumn;
     }
+
     public Integer getGeneratedColumn() {
-        return (Integer)readProperty("generatedColumn");
+        beforePropertyRead("generatedColumn");
+        return generatedColumn;
     }
 
     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 "generatedColumn":
+                return this.generatedColumn;
+            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 "generatedColumn":
+                this.generatedColumn = (Integer)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(generatedColumn);
+        out.writeObject(name);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        generatedColumn = (Integer)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/testmap/auto/_NullTestEntity.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_NullTestEntity.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_NullTestEntity.java
index 4e371f7..9f84715 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_NullTestEntity.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_NullTestEntity.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.testmap.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 _NullTestEntity extends CayenneDataObject {
+public abstract class _NullTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _NullTestEntity 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/testmap/auto/_Painting.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting.java
index a0c1810..b44e76c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting.java
@@ -1,5 +1,8 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.math.BigDecimal;
 
 import org.apache.cayenne.exp.Property;
@@ -27,25 +30,42 @@ public abstract class _Painting extends ArtDataObject {
     public static final Property<Gallery> TO_GALLERY = Property.create("toGallery", Gallery.class);
     public static final Property<PaintingInfo> TO_PAINTING_INFO = Property.create("toPaintingInfo", PaintingInfo.class);
 
+    protected BigDecimal estimatedPrice;
+    protected String paintingDescription;
+    protected String paintingTitle;
+
+    protected Object toArtist;
+    protected Object toGallery;
+    protected Object toPaintingInfo;
+
     public void setEstimatedPrice(BigDecimal estimatedPrice) {
-        writeProperty("estimatedPrice", estimatedPrice);
+        beforePropertyWrite("estimatedPrice", this.estimatedPrice, estimatedPrice);
+        this.estimatedPrice = estimatedPrice;
     }
+
     public BigDecimal getEstimatedPrice() {
-        return (BigDecimal)readProperty("estimatedPrice");
+        beforePropertyRead("estimatedPrice");
+        return estimatedPrice;
     }
 
     public void setPaintingDescription(String paintingDescription) {
-        writeProperty("paintingDescription", paintingDescription);
+        beforePropertyWrite("paintingDescription", this.paintingDescription, paintingDescription);
+        this.paintingDescription = paintingDescription;
     }
+
     public String getPaintingDescription() {
-        return (String)readProperty("paintingDescription");
+        beforePropertyRead("paintingDescription");
+        return paintingDescription;
     }
 
     public void setPaintingTitle(String paintingTitle) {
-        writeProperty("paintingTitle", paintingTitle);
+        beforePropertyWrite("paintingTitle", this.paintingTitle, paintingTitle);
+        this.paintingTitle = paintingTitle;
     }
+
     public String getPaintingTitle() {
-        return (String)readProperty("paintingTitle");
+        beforePropertyRead("paintingTitle");
+        return paintingTitle;
     }
 
     public void setToArtist(Artist toArtist) {
@@ -56,7 +76,6 @@ public abstract class _Painting extends ArtDataObject {
         return (Artist)readProperty("toArtist");
     }
 
-
     public void setToGallery(Gallery toGallery) {
         setToOneTarget("toGallery", toGallery, true);
     }
@@ -65,7 +84,6 @@ public abstract class _Painting extends ArtDataObject {
         return (Gallery)readProperty("toGallery");
     }
 
-
     public void setToPaintingInfo(PaintingInfo toPaintingInfo) {
         setToOneTarget("toPaintingInfo", toPaintingInfo, true);
     }
@@ -74,5 +92,88 @@ public abstract class _Painting extends ArtDataObject {
         return (PaintingInfo)readProperty("toPaintingInfo");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "estimatedPrice":
+                return this.estimatedPrice;
+            case "paintingDescription":
+                return this.paintingDescription;
+            case "paintingTitle":
+                return this.paintingTitle;
+            case "toArtist":
+                return this.toArtist;
+            case "toGallery":
+                return this.toGallery;
+            case "toPaintingInfo":
+                return this.toPaintingInfo;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "estimatedPrice":
+                this.estimatedPrice = (BigDecimal)val;
+                break;
+            case "paintingDescription":
+                this.paintingDescription = (String)val;
+                break;
+            case "paintingTitle":
+                this.paintingTitle = (String)val;
+                break;
+            case "toArtist":
+                this.toArtist = val;
+                break;
+            case "toGallery":
+                this.toGallery = val;
+                break;
+            case "toPaintingInfo":
+                this.toPaintingInfo = 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(estimatedPrice);
+        out.writeObject(paintingDescription);
+        out.writeObject(paintingTitle);
+        out.writeObject(toArtist);
+        out.writeObject(toGallery);
+        out.writeObject(toPaintingInfo);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        estimatedPrice = (BigDecimal)in.readObject();
+        paintingDescription = (String)in.readObject();
+        paintingTitle = (String)in.readObject();
+        toArtist = in.readObject();
+        toGallery = in.readObject();
+        toPaintingInfo = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting1.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting1.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting1.java
index 797581d..baa0ad9 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting1.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_Painting1.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.math.BigDecimal;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.testmap.Artist;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.testmap.Artist;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Painting1 extends CayenneDataObject {
+public abstract class _Painting1 extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,18 +25,29 @@ public abstract class _Painting1 extends CayenneDataObject {
     public static final Property<String> PAINTING_TITLE = Property.create("paintingTitle", String.class);
     public static final Property<Artist> TO_ARTIST = Property.create("toArtist", Artist.class);
 
+    protected BigDecimal estimatedPrice;
+    protected String paintingTitle;
+
+    protected Object toArtist;
+
     public void setEstimatedPrice(BigDecimal estimatedPrice) {
-        writeProperty("estimatedPrice", estimatedPrice);
+        beforePropertyWrite("estimatedPrice", this.estimatedPrice, estimatedPrice);
+        this.estimatedPrice = estimatedPrice;
     }
+
     public BigDecimal getEstimatedPrice() {
-        return (BigDecimal)readProperty("estimatedPrice");
+        beforePropertyRead("estimatedPrice");
+        return estimatedPrice;
     }
 
     public void setPaintingTitle(String paintingTitle) {
-        writeProperty("paintingTitle", paintingTitle);
+        beforePropertyWrite("paintingTitle", this.paintingTitle, paintingTitle);
+        this.paintingTitle = paintingTitle;
     }
+
     public String getPaintingTitle() {
-        return (String)readProperty("paintingTitle");
+        beforePropertyRead("paintingTitle");
+        return paintingTitle;
     }
 
     public void setToArtist(Artist toArtist) {
@@ -44,5 +58,67 @@ public abstract class _Painting1 extends CayenneDataObject {
         return (Artist)readProperty("toArtist");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "estimatedPrice":
+                return this.estimatedPrice;
+            case "paintingTitle":
+                return this.paintingTitle;
+            case "toArtist":
+                return this.toArtist;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "estimatedPrice":
+                this.estimatedPrice = (BigDecimal)val;
+                break;
+            case "paintingTitle":
+                this.paintingTitle = (String)val;
+                break;
+            case "toArtist":
+                this.toArtist = 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(estimatedPrice);
+        out.writeObject(paintingTitle);
+        out.writeObject(toArtist);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        estimatedPrice = (BigDecimal)in.readObject();
+        paintingTitle = (String)in.readObject();
+        toArtist = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_PaintingInfo.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_PaintingInfo.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_PaintingInfo.java
index 81930b6..4fe1805 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_PaintingInfo.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_PaintingInfo.java
@@ -1,6 +1,10 @@
 package org.apache.cayenne.testdo.testmap.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.testmap.Painting;
 
@@ -10,7 +14,7 @@ import org.apache.cayenne.testdo.testmap.Painting;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _PaintingInfo extends CayenneDataObject {
+public abstract class _PaintingInfo extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -20,18 +24,29 @@ public abstract class _PaintingInfo extends CayenneDataObject {
     public static final Property<String> TEXT_REVIEW = Property.create("textReview", String.class);
     public static final Property<Painting> PAINTING = Property.create("painting", Painting.class);
 
+    protected byte[] imageBlob;
+    protected String textReview;
+
+    protected Object painting;
+
     public void setImageBlob(byte[] imageBlob) {
-        writeProperty("imageBlob", imageBlob);
+        beforePropertyWrite("imageBlob", this.imageBlob, imageBlob);
+        this.imageBlob = imageBlob;
     }
+
     public byte[] getImageBlob() {
-        return (byte[])readProperty("imageBlob");
+        beforePropertyRead("imageBlob");
+        return imageBlob;
     }
 
     public void setTextReview(String textReview) {
-        writeProperty("textReview", textReview);
+        beforePropertyWrite("textReview", this.textReview, textReview);
+        this.textReview = textReview;
     }
+
     public String getTextReview() {
-        return (String)readProperty("textReview");
+        beforePropertyRead("textReview");
+        return textReview;
     }
 
     public void setPainting(Painting painting) {
@@ -42,5 +57,67 @@ public abstract class _PaintingInfo extends CayenneDataObject {
         return (Painting)readProperty("painting");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "imageBlob":
+                return this.imageBlob;
+            case "textReview":
+                return this.textReview;
+            case "painting":
+                return this.painting;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "imageBlob":
+                this.imageBlob = (byte[])val;
+                break;
+            case "textReview":
+                this.textReview = (String)val;
+                break;
+            case "painting":
+                this.painting = 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(imageBlob);
+        out.writeObject(textReview);
+        out.writeObject(painting);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        imageBlob = (byte[])in.readObject();
+        textReview = (String)in.readObject();
+        painting = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROArtist.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROArtist.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROArtist.java
index 40a307d..d4640fe 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROArtist.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROArtist.java
@@ -1,9 +1,12 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.sql.Date;
 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.testmap.Painting;
 
@@ -13,7 +16,7 @@ import org.apache.cayenne.testdo.testmap.Painting;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ROArtist extends CayenneDataObject {
+public abstract class _ROArtist extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -23,24 +26,95 @@ public abstract class _ROArtist extends CayenneDataObject {
     public static final Property<Date> DATE_OF_BIRTH = Property.create("dateOfBirth", Date.class);
     public static final Property<List<Painting>> PAINTING_ARRAY = Property.create("paintingArray", List.class);
 
+    protected String artistName;
+    protected Date dateOfBirth;
+
+    protected Object paintingArray;
+
     public String getArtistName() {
-        return (String)readProperty("artistName");
+        beforePropertyRead("artistName");
+        return artistName;
     }
 
     public Date getDateOfBirth() {
-        return (Date)readProperty("dateOfBirth");
+        beforePropertyRead("dateOfBirth");
+        return dateOfBirth;
     }
 
     public void addToPaintingArray(Painting obj) {
         addToManyTarget("paintingArray", obj, true);
     }
+
     public void removeFromPaintingArray(Painting obj) {
         removeToManyTarget("paintingArray", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Painting> getPaintingArray() {
         return (List<Painting>)readProperty("paintingArray");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "artistName":
+                return this.artistName;
+            case "dateOfBirth":
+                return this.dateOfBirth;
+            case "paintingArray":
+                return this.paintingArray;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "artistName":
+                this.artistName = (String)val;
+                break;
+            case "dateOfBirth":
+                this.dateOfBirth = (Date)val;
+                break;
+            case "paintingArray":
+                this.paintingArray = 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(artistName);
+        out.writeObject(dateOfBirth);
+        out.writeObject(paintingArray);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        artistName = (String)in.readObject();
+        dateOfBirth = (Date)in.readObject();
+        paintingArray = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROPainting.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROPainting.java b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROPainting.java
index b0b4d95..84a95e7 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROPainting.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_ROPainting.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.testmap.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.math.BigDecimal;
 
-import org.apache.cayenne.CayenneDataObject;
+import org.apache.cayenne.BaseDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.testmap.Artist;
 
@@ -12,7 +15,7 @@ import org.apache.cayenne.testdo.testmap.Artist;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _ROPainting extends CayenneDataObject {
+public abstract class _ROPainting extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -22,18 +25,86 @@ public abstract class _ROPainting extends CayenneDataObject {
     public static final Property<String> PAINTING_TITLE = Property.create("paintingTitle", String.class);
     public static final Property<Artist> TO_ARTIST = Property.create("toArtist", Artist.class);
 
+    protected BigDecimal estimatedPrice;
+    protected String paintingTitle;
+
+    protected Object toArtist;
+
     public BigDecimal getEstimatedPrice() {
-        return (BigDecimal)readProperty("estimatedPrice");
+        beforePropertyRead("estimatedPrice");
+        return estimatedPrice;
     }
 
     public String getPaintingTitle() {
-        return (String)readProperty("paintingTitle");
+        beforePropertyRead("paintingTitle");
+        return paintingTitle;
     }
 
-
     public Artist getToArtist() {
         return (Artist)readProperty("toArtist");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "estimatedPrice":
+                return this.estimatedPrice;
+            case "paintingTitle":
+                return this.paintingTitle;
+            case "toArtist":
+                return this.toArtist;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "estimatedPrice":
+                this.estimatedPrice = (BigDecimal)val;
+                break;
+            case "paintingTitle":
+                this.paintingTitle = (String)val;
+                break;
+            case "toArtist":
+                this.toArtist = 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(estimatedPrice);
+        out.writeObject(paintingTitle);
+        out.writeObject(toArtist);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
+        super.readState(in);
+        estimatedPrice = (BigDecimal)in.readObject();
+        paintingTitle = (String)in.readObject();
+        toArtist = in.readObject();
+    }
 
 }


Mime
View raw message