Repository: cayenne
Updated Branches:
  refs/heads/master caaeb99bf -> 7b762e9a3


http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_RWCompoundPainting.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_RWCompoundPainting.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_RWCompoundPainting.java
index f4a84f3..2a01c13 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_RWCompoundPainting.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_RWCompoundPainting.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;
 
 /**
@@ -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 _RWCompoundPainting extends CayenneDataObject {
+public abstract class _RWCompoundPainting extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -21,25 +24,102 @@ public abstract class _RWCompoundPainting extends 
CayenneDataObject {
     public static final Property<String> PAINTING_TITLE = 
Property.create("paintingTitle", String.class);
     public static final Property<String> TEXT_REVIEW = 
Property.create("textReview", String.class);
 
+    protected BigDecimal estimatedPrice;
+    protected String paintingTitle;
+    protected String textReview;
+
+
     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 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;
+    }
+
+    @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 "textReview":
+                return this.textReview;
+            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 "textReview":
+                this.textReview = (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(estimatedPrice);
+        out.writeObject(paintingTitle);
+        out.writeObject(textReview);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        estimatedPrice = (BigDecimal)in.readObject();
+        paintingTitle = (String)in.readObject();
+        textReview = (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/_SubPainting.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_SubPainting.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_SubPainting.java
index 9029232..44f0d97 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_SubPainting.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/testmap/auto/_SubPainting.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 _SubPainting extends CayenneDataObject {
+public abstract class _SubPainting extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -17,11 +21,66 @@ public abstract class _SubPainting extends 
CayenneDataObject {
 
     public static final Property<String> PAINTING_TITLE = 
Property.create("paintingTitle", String.class);
 
+    protected String paintingTitle;
+
+
     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;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "paintingTitle":
+                return this.paintingTitle;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "paintingTitle":
+                this.paintingTitle = (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(paintingTitle);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        paintingTitle = (String)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Bag.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Bag.java 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Bag.java
index ca0a68e..de58c44 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Bag.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Bag.java
@@ -1,5 +1,8 @@
 package org.apache.cayenne.testdo.things.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
 import org.apache.cayenne.CayenneDataObject;
@@ -25,11 +28,20 @@ public abstract class _Bag extends CayenneDataObject {
     public static final Property<List<Box>> BOXES = Property.create("boxes", 
List.class);
     public static final Property<List<Thing>> THINGS = 
Property.create("things", List.class);
 
+    protected String name;
+
+    protected Object balls;
+    protected Object boxes;
+    protected Object things;
+
     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;
     }
 
     @SuppressWarnings("unchecked")
@@ -37,23 +49,92 @@ public abstract class _Bag extends CayenneDataObject {
         return (List<Ball>)readProperty("balls");
     }
 
-
     public void addToBoxes(Box obj) {
         addToManyTarget("boxes", obj, true);
     }
+
     public void removeFromBoxes(Box obj) {
         removeToManyTarget("boxes", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Box> getBoxes() {
         return (List<Box>)readProperty("boxes");
     }
 
-
     @SuppressWarnings("unchecked")
     public List<Thing> getThings() {
         return (List<Thing>)readProperty("things");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "balls":
+                return this.balls;
+            case "boxes":
+                return this.boxes;
+            case "things":
+                return this.things;
+            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 "balls":
+                this.balls = val;
+                break;
+            case "boxes":
+                this.boxes = val;
+                break;
+            case "things":
+                this.things = 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(balls);
+        out.writeObject(boxes);
+        out.writeObject(things);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        balls = in.readObject();
+        boxes = in.readObject();
+        things = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Ball.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Ball.java 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Ball.java
index 6ecb6de..cffdcc9 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Ball.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Ball.java
@@ -1,5 +1,9 @@
 package org.apache.cayenne.testdo.things.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
 import org.apache.cayenne.CayenneDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.things.Box;
@@ -22,18 +26,30 @@ public abstract class _Ball extends CayenneDataObject {
     public static final Property<Box> BOX = Property.create("box", Box.class);
     public static final Property<Thing> THING = Property.create("thing", 
Thing.class);
 
+    protected Integer thingVolume;
+    protected Integer thingWeight;
+
+    protected Object box;
+    protected Object thing;
+
     public void setThingVolume(Integer thingVolume) {
-        writeProperty("thingVolume", thingVolume);
+        beforePropertyWrite("thingVolume", this.thingVolume, thingVolume);
+        this.thingVolume = thingVolume;
     }
+
     public Integer getThingVolume() {
-        return (Integer)readProperty("thingVolume");
+        beforePropertyRead("thingVolume");
+        return thingVolume;
     }
 
     public void setThingWeight(Integer thingWeight) {
-        writeProperty("thingWeight", thingWeight);
+        beforePropertyWrite("thingWeight", this.thingWeight, thingWeight);
+        this.thingWeight = thingWeight;
     }
+
     public Integer getThingWeight() {
-        return (Integer)readProperty("thingWeight");
+        beforePropertyRead("thingWeight");
+        return thingWeight;
     }
 
     public void setBox(Box box) {
@@ -44,7 +60,6 @@ public abstract class _Ball extends CayenneDataObject {
         return (Box)readProperty("box");
     }
 
-
     public void setThing(Thing thing) {
         setToOneTarget("thing", thing, true);
     }
@@ -53,5 +68,74 @@ public abstract class _Ball extends CayenneDataObject {
         return (Thing)readProperty("thing");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "thingVolume":
+                return this.thingVolume;
+            case "thingWeight":
+                return this.thingWeight;
+            case "box":
+                return this.box;
+            case "thing":
+                return this.thing;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "thingVolume":
+                this.thingVolume = (Integer)val;
+                break;
+            case "thingWeight":
+                this.thingWeight = (Integer)val;
+                break;
+            case "box":
+                this.box = val;
+                break;
+            case "thing":
+                this.thing = 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(thingVolume);
+        out.writeObject(thingWeight);
+        out.writeObject(box);
+        out.writeObject(thing);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        thingVolume = (Integer)in.readObject();
+        thingWeight = (Integer)in.readObject();
+        box = in.readObject();
+        thing = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Box.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Box.java 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Box.java
index 25d42ca..9a9b09e 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Box.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Box.java
@@ -1,5 +1,8 @@
 package org.apache.cayenne.testdo.things.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
 import org.apache.cayenne.CayenneDataObject;
@@ -27,11 +30,21 @@ public abstract class _Box extends CayenneDataObject {
     public static final Property<BoxInfo> BOX_INFO = 
Property.create("boxInfo", BoxInfo.class);
     public static final Property<List<Thing>> THINGS = 
Property.create("things", List.class);
 
+    protected String name;
+
+    protected Object bag;
+    protected Object balls;
+    protected Object boxInfo;
+    protected Object things;
+
     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 setBag(Bag bag) {
@@ -42,19 +55,19 @@ public abstract class _Box extends CayenneDataObject {
         return (Bag)readProperty("bag");
     }
 
-
     public void addToBalls(Ball obj) {
         addToManyTarget("balls", obj, true);
     }
+
     public void removeFromBalls(Ball obj) {
         removeToManyTarget("balls", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Ball> getBalls() {
         return (List<Ball>)readProperty("balls");
     }
 
-
     public void setBoxInfo(BoxInfo boxInfo) {
         setToOneTarget("boxInfo", boxInfo, true);
     }
@@ -63,11 +76,86 @@ public abstract class _Box extends CayenneDataObject {
         return (BoxInfo)readProperty("boxInfo");
     }
 
-
     @SuppressWarnings("unchecked")
     public List<Thing> getThings() {
         return (List<Thing>)readProperty("things");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "name":
+                return this.name;
+            case "bag":
+                return this.bag;
+            case "balls":
+                return this.balls;
+            case "boxInfo":
+                return this.boxInfo;
+            case "things":
+                return this.things;
+            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 "bag":
+                this.bag = val;
+                break;
+            case "balls":
+                this.balls = val;
+                break;
+            case "boxInfo":
+                this.boxInfo = val;
+                break;
+            case "things":
+                this.things = 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(bag);
+        out.writeObject(balls);
+        out.writeObject(boxInfo);
+        out.writeObject(things);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        name = (String)in.readObject();
+        bag = in.readObject();
+        balls = in.readObject();
+        boxInfo = in.readObject();
+        things = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_BoxInfo.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_BoxInfo.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_BoxInfo.java
index 5242a02..2a23b29 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_BoxInfo.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_BoxInfo.java
@@ -1,5 +1,9 @@
 package org.apache.cayenne.testdo.things.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
 import org.apache.cayenne.CayenneDataObject;
 import org.apache.cayenne.exp.Property;
 import org.apache.cayenne.testdo.things.Box;
@@ -19,11 +23,18 @@ public abstract class _BoxInfo extends CayenneDataObject {
     public static final Property<String> COLOR = Property.create("color", 
String.class);
     public static final Property<Box> BOX = Property.create("box", Box.class);
 
+    protected String color;
+
+    protected Object box;
+
     public void setColor(String color) {
-        writeProperty("color", color);
+        beforePropertyWrite("color", this.color, color);
+        this.color = color;
     }
+
     public String getColor() {
-        return (String)readProperty("color");
+        beforePropertyRead("color");
+        return color;
     }
 
     public void setBox(Box box) {
@@ -34,5 +45,60 @@ public abstract class _BoxInfo extends CayenneDataObject {
         return (Box)readProperty("box");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "color":
+                return this.color;
+            case "box":
+                return this.box;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "color":
+                this.color = (String)val;
+                break;
+            case "box":
+                this.box = 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(color);
+        out.writeObject(box);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        color = (String)in.readObject();
+        box = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Thing.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Thing.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Thing.java
index 29b14d9..d184188 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Thing.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/things/auto/_Thing.java
@@ -1,5 +1,8 @@
 package org.apache.cayenne.testdo.things.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.List;
 
 import org.apache.cayenne.CayenneDataObject;
@@ -24,18 +27,30 @@ public abstract class _Thing extends CayenneDataObject {
     public static final Property<Ball> BALL = Property.create("ball", 
Ball.class);
     public static final Property<List<Box>> BOX = Property.create("box", 
List.class);
 
+    protected Integer volume;
+    protected Integer weight;
+
+    protected Object ball;
+    protected Object box;
+
     public void setVolume(Integer volume) {
-        writeProperty("volume", volume);
+        beforePropertyWrite("volume", this.volume, volume);
+        this.volume = volume;
     }
+
     public Integer getVolume() {
-        return (Integer)readProperty("volume");
+        beforePropertyRead("volume");
+        return volume;
     }
 
     public void setWeight(Integer weight) {
-        writeProperty("weight", weight);
+        beforePropertyWrite("weight", this.weight, weight);
+        this.weight = weight;
     }
+
     public Integer getWeight() {
-        return (Integer)readProperty("weight");
+        beforePropertyRead("weight");
+        return weight;
     }
 
     public void setBall(Ball ball) {
@@ -46,11 +61,79 @@ public abstract class _Thing extends CayenneDataObject {
         return (Ball)readProperty("ball");
     }
 
-
     @SuppressWarnings("unchecked")
     public List<Box> getBox() {
         return (List<Box>)readProperty("box");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "volume":
+                return this.volume;
+            case "weight":
+                return this.weight;
+            case "ball":
+                return this.ball;
+            case "box":
+                return this.box;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "volume":
+                this.volume = (Integer)val;
+                break;
+            case "weight":
+                this.weight = (Integer)val;
+                break;
+            case "ball":
+                this.ball = val;
+                break;
+            case "box":
+                this.box = 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(volume);
+        out.writeObject(weight);
+        out.writeObject(ball);
+        out.writeObject(box);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        volume = (Integer)in.readObject();
+        weight = (Integer)in.readObject();
+        ball = in.readObject();
+        box = in.readObject();
+    }
 
 }

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

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

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

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/unsupported_distinct_types/auto/_Product.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/unsupported_distinct_types/auto/_Product.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/unsupported_distinct_types/auto/_Product.java
index 9739b36..d61e552 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/unsupported_distinct_types/auto/_Product.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/unsupported_distinct_types/auto/_Product.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.unsupported_distinct_types.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.unsupported_distinct_types.Customer;
 import org.apache.cayenne.testdo.unsupported_distinct_types.Product;
@@ -13,7 +16,7 @@ import 
org.apache.cayenne.testdo.unsupported_distinct_types.Product;
  * since it may be overwritten next time code is regenerated.
  * If you need to make any customizations, please use subclass.
  */
-public abstract class _Product extends CayenneDataObject {
+public abstract class _Product extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -24,47 +27,129 @@ public abstract class _Product extends CayenneDataObject {
     public static final Property<List<Product>> CONTAINED = 
Property.create("contained", List.class);
     public static final Property<List<Customer>> ORDER_BY = 
Property.create("orderBy", List.class);
 
+    protected String longvarcharCol;
+
+    protected Object base;
+    protected Object contained;
+    protected Object orderBy;
+
     public void setLongvarcharCol(String longvarcharCol) {
-        writeProperty("longvarcharCol", longvarcharCol);
+        beforePropertyWrite("longvarcharCol", this.longvarcharCol, 
longvarcharCol);
+        this.longvarcharCol = longvarcharCol;
     }
+
     public String getLongvarcharCol() {
-        return (String)readProperty("longvarcharCol");
+        beforePropertyRead("longvarcharCol");
+        return longvarcharCol;
     }
 
     public void addToBase(Product obj) {
         addToManyTarget("base", obj, true);
     }
+
     public void removeFromBase(Product obj) {
         removeToManyTarget("base", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Product> getBase() {
         return (List<Product>)readProperty("base");
     }
 
-
     public void addToContained(Product obj) {
         addToManyTarget("contained", obj, true);
     }
+
     public void removeFromContained(Product obj) {
         removeToManyTarget("contained", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Product> getContained() {
         return (List<Product>)readProperty("contained");
     }
 
-
     public void addToOrderBy(Customer obj) {
         addToManyTarget("orderBy", obj, true);
     }
+
     public void removeFromOrderBy(Customer obj) {
         removeToManyTarget("orderBy", obj, true);
     }
+
     @SuppressWarnings("unchecked")
     public List<Customer> getOrderBy() {
         return (List<Customer>)readProperty("orderBy");
     }
 
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "longvarcharCol":
+                return this.longvarcharCol;
+            case "base":
+                return this.base;
+            case "contained":
+                return this.contained;
+            case "orderBy":
+                return this.orderBy;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "longvarcharCol":
+                this.longvarcharCol = (String)val;
+                break;
+            case "base":
+                this.base = val;
+                break;
+            case "contained":
+                this.contained = val;
+                break;
+            case "orderBy":
+                this.orderBy = 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(longvarcharCol);
+        out.writeObject(base);
+        out.writeObject(contained);
+        out.writeObject(orderBy);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        longvarcharCol = (String)in.readObject();
+        base = in.readObject();
+        contained = in.readObject();
+        orderBy = in.readObject();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidPkEntity.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidPkEntity.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidPkEntity.java
index 1550c32..2f77d87 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidPkEntity.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidPkEntity.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.uuid.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.UUID;
 
-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 _UuidPkEntity extends CayenneDataObject {
+public abstract class _UuidPkEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +22,66 @@ public abstract class _UuidPkEntity extends 
CayenneDataObject {
 
     public static final Property<UUID> ID = Property.create("id", UUID.class);
 
+    protected UUID id;
+
+
     public void setId(UUID id) {
-        writeProperty("id", id);
+        beforePropertyWrite("id", this.id, id);
+        this.id = id;
     }
+
     public UUID getId() {
-        return (UUID)readProperty("id");
+        beforePropertyRead("id");
+        return id;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "id":
+                return this.id;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "id":
+                this.id = (UUID)val;
+                break;
+            default:
+                super.writePropertyDirectly(propName, val);
+        }
+    }
+
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        writeSerialized(out);
+    }
+
+    private void readObject(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        readSerialized(in);
+    }
+
+    @Override
+    protected void writeState(ObjectOutputStream out) throws IOException {
+        super.writeState(out);
+        out.writeObject(id);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        id = (UUID)in.readObject();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidTestEntity.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidTestEntity.java
 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidTestEntity.java
index c5f0671..3342cb6 100644
--- 
a/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidTestEntity.java
+++ 
b/cayenne-server/src/test/java/org/apache/cayenne/testdo/uuid/auto/_UuidTestEntity.java
@@ -1,8 +1,11 @@
 package org.apache.cayenne.testdo.uuid.auto;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.UUID;
 
-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 _UuidTestEntity extends CayenneDataObject {
+public abstract class _UuidTestEntity extends BaseDataObject {
 
     private static final long serialVersionUID = 1L; 
 
@@ -19,11 +22,66 @@ public abstract class _UuidTestEntity extends 
CayenneDataObject {
 
     public static final Property<UUID> UUID = Property.create("uuid", 
UUID.class);
 
+    protected UUID uuid;
+
+
     public void setUuid(UUID uuid) {
-        writeProperty("uuid", uuid);
+        beforePropertyWrite("uuid", this.uuid, uuid);
+        this.uuid = uuid;
     }
+
     public UUID getUuid() {
-        return (UUID)readProperty("uuid");
+        beforePropertyRead("uuid");
+        return uuid;
+    }
+
+    @Override
+    public Object readPropertyDirectly(String propName) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch(propName) {
+            case "uuid":
+                return this.uuid;
+            default:
+                return super.readPropertyDirectly(propName);
+        }
+    }
+
+    @Override
+    public void writePropertyDirectly(String propName, Object val) {
+        if(propName == null) {
+            throw new IllegalArgumentException();
+        }
+
+        switch (propName) {
+            case "uuid":
+                this.uuid = (UUID)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(uuid);
+    }
+
+    @Override
+    protected void readState(ObjectInputStream in) throws IOException, 
ClassNotFoundException {
+        super.readState(in);
+        uuid = (UUID)in.readObject();
     }
 
 }

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

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

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/cayenne-server/src/test/resources/testmap.map.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/testmap.map.xml 
b/cayenne-server/src/test/resources/testmap.map.xml
index 8e082d9..3805003 100644
--- a/cayenne-server/src/test/resources/testmap.map.xml
+++ b/cayenne-server/src/test/resources/testmap.map.xml
@@ -109,7 +109,7 @@
                <obj-attribute name="paintingTitle" type="java.lang.String" 
db-attribute-path="PAINTING_TITLE"/>
                <obj-attribute name="textReview" type="java.lang.String" 
db-attribute-path="toPaintingInfo.TEXT_REVIEW"/>
        </obj-entity>
-       <obj-entity name="CompoundPaintingLongNames" 
className="org.apache.cayenne.testdo.testmap.CompoundPaintingLongNames" 
clientClassName="test.client.CompoundPaintingLongNames" dbEntityName="PAINTING" 
superClassName="org.apache.cayenne.CayenneDataObject" 
clientSuperClassName="org.apache.cayenne.PersistentObject">
+       <obj-entity name="CompoundPaintingLongNames" 
className="org.apache.cayenne.testdo.testmap.CompoundPaintingLongNames" 
clientClassName="test.client.CompoundPaintingLongNames" dbEntityName="PAINTING" 
clientSuperClassName="org.apache.cayenne.PersistentObject">
                <obj-attribute name="artistLongName" type="java.lang.String" 
db-attribute-path="toArtist.ARTIST_NAME"/>
                <obj-attribute name="estimatedPrice" 
type="java.math.BigDecimal" db-attribute-path="ESTIMATED_PRICE"/>
                <obj-attribute name="galleryLongName" type="java.lang.String" 
db-attribute-path="toGallery.GALLERY_NAME"/>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt 
b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 4192d30..7a373a0 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -14,6 +14,7 @@ Date:
 Changes/New Features:
 
 CAY-2329 Update project dependencies
+CAY-2330 Field based data objects
 
 Bug Fixes:
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/docs/doc/src/main/resources/UPGRADE.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/UPGRADE.txt 
b/docs/doc/src/main/resources/UPGRADE.txt
index 45ae5d1..3594439 100644
--- a/docs/doc/src/main/resources/UPGRADE.txt
+++ b/docs/doc/src/main/resources/UPGRADE.txt
@@ -5,6 +5,14 @@ IMPORTANT: be sure to read all notes for the intermediate 
releases between your
            current release and the release you are upgrading to.
 -------------------------------------------------------------------------------
 
+UPGRADING TO 4.1.M1
+
+* Per CAY-2330 Field-based data objects are introduced and enabled by default.
+      Your existing code will continue to work, but in order to get benefits 
from this feature you should
+      regenerate code via Modeler ("Tools" -> "Generate Classes") or cgen 
tools in Maven/Ant/Gradle plugins.
+      Also note that serialization format of old data objects have changed, 
make sure you don't use serialization
+      form to store your objects.
+
 UPGRADING TO 4.0.B1
 
 * Per CAY-2302 postcommit module and all it's internals renamed to commitlog.

http://git-wip-us.apache.org/repos/asf/cayenne/blob/544aae08/itests/cayenne-tools-itest/src/test/java/org/apache/cayenne/tools/CayenneGeneratorIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/itests/cayenne-tools-itest/src/test/java/org/apache/cayenne/tools/CayenneGeneratorIntegrationTest.java
 
b/itests/cayenne-tools-itest/src/test/java/org/apache/cayenne/tools/CayenneGeneratorIntegrationTest.java
index dfb9d8f..2142389 100644
--- 
a/itests/cayenne-tools-itest/src/test/java/org/apache/cayenne/tools/CayenneGeneratorIntegrationTest.java
+++ 
b/itests/cayenne-tools-itest/src/test/java/org/apache/cayenne/tools/CayenneGeneratorIntegrationTest.java
@@ -57,7 +57,7 @@ public class CayenneGeneratorIntegrationTest {
         startTest("single-classes1");
 
         assertContents("org/apache/cayenne/testdo/testmap/Artist.java", 
"Artist", "org.apache.cayenne.testdo.testmap",
-                "CayenneDataObject");
+                "BaseDataObject");
         assertExists("org/apache/cayenne/testdo/testmap/_Artist.java");
     }
 
@@ -66,7 +66,7 @@ public class CayenneGeneratorIntegrationTest {
     public void testSingleClasses2() throws Exception {
         startTest("single-classes2");
 
-        assertContents("Artist.java", "Artist", 
"org.apache.cayenne.testdo.testmap", "CayenneDataObject");
+        assertContents("Artist.java", "Artist", 
"org.apache.cayenne.testdo.testmap", "BaseDataObject");
         assertExists("_Artist.java");
         assertExists("org/apache/cayenne/testdo/testmap/Artist.java");
     }
@@ -79,7 +79,7 @@ public class CayenneGeneratorIntegrationTest {
         assertContents("org/apache/cayenne/testdo/testmap/Artist.java", 
"Artist", "org.apache.cayenne.testdo.testmap",
                 "_Artist");
         assertContents("org/apache/cayenne/testdo/testmap/auto/_Artist.java", 
"_Artist",
-                "org.apache.cayenne.testdo.testmap.auto", "CayenneDataObject");
+                "org.apache.cayenne.testdo.testmap.auto", "BaseDataObject");
     }
 
     /** Test pairs generation in the same directory. */
@@ -88,7 +88,7 @@ public class CayenneGeneratorIntegrationTest {
         startTest("pairs2");
 
         assertContents("Artist.java", "Artist", 
"org.apache.cayenne.testdo.testmap", "_Artist");
-        assertContents("_Artist.java", "_Artist", 
"org.apache.cayenne.testdo.testmap", "CayenneDataObject");
+        assertContents("_Artist.java", "_Artist", 
"org.apache.cayenne.testdo.testmap", "BaseDataObject");
         assertExists("org/apache/cayenne/testdo/testmap/Artist.java");
     }
 
@@ -103,7 +103,7 @@ public class CayenneGeneratorIntegrationTest {
         assertContents("org/apache/cayenne/testdo/testmap/Artist.java", 
"Artist", "org.apache.cayenne.testdo.testmap",
                 "_Artist");
         
assertContents("org/apache/cayenne/testdo/testmap/superart/_Artist.java", 
"_Artist",
-                "org.apache.cayenne.testdo.testmap.superart", 
"CayenneDataObject");
+                "org.apache.cayenne.testdo.testmap.superart", 
"BaseDataObject");
     }
 
     @Test
@@ -123,7 +123,7 @@ public class CayenneGeneratorIntegrationTest {
         
assertContents("org/apache/cayenne/testdo/embeddable/EmbedEntity1.java", 
"EmbedEntity1",
                 "org.apache.cayenne.testdo.embeddable", "_EmbedEntity1");
         
assertContents("org/apache/cayenne/testdo/embeddable/auto/_EmbedEntity1.java", 
"_EmbedEntity1",
-                "org.apache.cayenne.testdo.embeddable.auto", 
"CayenneDataObject");
+                "org.apache.cayenne.testdo.embeddable.auto", "BaseDataObject");
         
assertContents("org/apache/cayenne/testdo/embeddable/Embeddable1.java", 
"Embeddable1",
                 "org.apache.cayenne.testdo.embeddable", "_Embeddable1");
         
assertContents("org/apache/cayenne/testdo/embeddable/auto/_Embeddable1.java", 
"_Embeddable1",

Reply via email to