gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmarroq...@apache.org
Subject [2/2] git commit: GORA-326 Removal of _g_dirty field from _ALL_FIELDS array and Field Enum in Persistent classes
Date Mon, 18 Aug 2014 21:10:57 GMT
GORA-326 Removal of _g_dirty field from _ALL_FIELDS array and Field Enum in Persistent classes


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/60ce6487
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/60ce6487
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/60ce6487

Branch: refs/heads/master
Commit: 60ce64877ea44cdc6ab295f8e6715e6da1b88ff8
Parents: f840b5d
Author: Renato Marroquin <rmarroquin@apache.org>
Authored: Mon Aug 18 18:21:17 2014 +0200
Committer: Renato Marroquin <rmarroquin@apache.org>
Committed: Mon Aug 18 18:21:17 2014 +0200

----------------------------------------------------------------------
 .../gora/accumulo/store/AccumuloStore.java      |   2 +-
 .../org/apache/gora/compiler/GoraCompiler.java  |   3 +-
 .../apache/gora/compiler/templates/record.vm    |   8 +
 .../gora/examples/generated/Employee.java       | 174 +++--
 .../examples/generated/ImmutableFields.java     |  77 ++-
 .../gora/examples/generated/Metadata.java       |  77 ++-
 .../gora/examples/generated/TokenDatum.java     |  53 +-
 .../org/apache/gora/examples/generated/V2.java  |  53 +-
 .../apache/gora/examples/generated/WebPage.java | 173 +++--
 .../gora/persistency/impl/PersistentBase.java   |  14 +-
 .../java/org/apache/gora/util/AvroUtils.java    |   4 +-
 .../gora/mock/persistency/MockPersistent.java   |   9 +-
 .../org/apache/gora/hbase/store/HBaseStore.java |   2 +-
 .../tutorial/log/generated/MetricDatum.java     | 142 +++--
 .../gora/tutorial/log/generated/Pageview.java   | 636 ++++++++++---------
 15 files changed, 771 insertions(+), 656 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
----------------------------------------------------------------------
diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
index fff12be..58e84ac 100644
--- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
+++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
@@ -657,7 +657,7 @@ public class AccumuloStore<K,T extends PersistentBase> extends DataStoreBase<K,T
       List<Field> fields = schema.getFields();
       int count = 0;
 
-      for (int i = 1; i < fields.size(); i++) {
+      for (int i = 0; i < fields.size(); i++) {
         if (!val.isDirty(i)) {
           continue;
         }

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
----------------------------------------------------------------------
diff --git a/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java b/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
index 84090e4..f0a04f4 100644
--- a/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
+++ b/gora-compiler/src/main/java/org/apache/gora/compiler/GoraCompiler.java
@@ -59,7 +59,8 @@ public class GoraCompiler extends SpecificCompiler {
       System.out.println("Compiling: " + src.getAbsolutePath());
       Schema originalSchema = parser.parse(src);
       Map<Schema,Schema> queue = new HashMap<Schema,Schema>();
-      Schema newSchema = getSchemaWithDirtySupport(originalSchema, queue);
+      //Schema newSchema = getSchemaWithDirtySupport(originalSchema, queue);
+      Schema newSchema = originalSchema;
       GoraCompiler compiler = new GoraCompiler(newSchema);
       compiler.setTemplateDir("/org/apache/gora/compiler/templates/");
       compiler.compileToDestination(src, dest);

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
----------------------------------------------------------------------
diff --git a/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm b/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
index 78f5d13..1ce535e 100644
--- a/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
+++ b/gora-compiler/src/main/velocity/org/apache/gora/compiler/templates/record.vm
@@ -75,6 +75,14 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or
 #end
   };
 
+  /**
+   * Gets the total field count.
+   * @return int field count
+   */
+  public int getFieldsCount() {
+    return ${this.mangle($schema.getName())}._ALL_FIELDS.length;
+  }
+
 #foreach ($field in $schema.getFields())
 #if ($field.doc())
   /** $field.doc() */

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java b/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
index 1dd4b76..fb76b30 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/Employee.java
@@ -6,17 +6,16 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class Employee extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"dateOfBirth\",\"type\":\"long\",\"default\":0},{\"name\":\"ssn\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"salary\",\"type\":\"int\",\"default\":0},{\"name\":\"boss\",\"type\":[\"null\",\"Employee\",\"string\"],\"default\":null},{\"name\":\"webpage\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"WebPage\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":[\"null\",\
 "bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"default\":{}},{\"name\":\"headers\",\"type\":[\"null\",{\"type\":\"map\",\"values\":[\"null\",\"string\"]}],\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]},\"default\":null}]}],\"default\":null}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"dateOfBirth\",\"type\":\"long\",\"default\":0},{\"name\":\"ssn\",\"type\":\"string\",\"default\":\"\"},{\"name\":\"salary\",\"type\":\"int\",\"default\":0},{\"name\":\"boss\",\"type\":[\"null\",\"Employee\",\"string\"],\"default\":null},{\"name\":\"webpage\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"WebPage\",\"fields\":[{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"default\":{}},{\"name\":\"headers\",\"type\":[\"null\",{\"typ
 e\":\"map\",\"values\":[\"null\",\"string\"]}],\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]},\"default\":null}]}],\"default\":null}],\"default\":null}");
 
   /** Enum containing all data bean's fields. */
   public static enum Field {
-    __G__DIRTY(0, "__g__dirty"),
-    NAME(1, "name"),
-    DATE_OF_BIRTH(2, "dateOfBirth"),
-    SSN(3, "ssn"),
-    SALARY(4, "salary"),
-    BOSS(5, "boss"),
-    WEBPAGE(6, "webpage"),
+    NAME(0, "name"),
+    DATE_OF_BIRTH(1, "dateOfBirth"),
+    SSN(2, "ssn"),
+    SALARY(3, "salary"),
+    BOSS(4, "boss"),
+    WEBPAGE(5, "webpage"),
     ;
     /**
      * Field's index.
@@ -55,7 +54,6 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
   };
 
   public static final String[] _ALL_FIELDS = {
-  "__g__dirty",
   "name",
   "dateOfBirth",
   "ssn",
@@ -64,8 +62,14 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
   "webpage",
   };
 
-  /** Bytes used to represent weather or not a field is dirty. */
-  private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
+  /**
+   * Gets the total field count.
+   * @return int field count
+   */
+  public int getFieldsCount() {
+    return Employee._ALL_FIELDS.length;
+  }
+
   private java.lang.CharSequence name;
   private long dateOfBirth;
   private java.lang.CharSequence ssn;
@@ -76,27 +80,26 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
   // Used by DatumWriter.  Applications should not call. 
   public java.lang.Object get(int field$) {
     switch (field$) {
-    case 0: return __g__dirty;
-    case 1: return name;
-    case 2: return dateOfBirth;
-    case 3: return ssn;
-    case 4: return salary;
-    case 5: return boss;
-    case 6: return webpage;
+    case 0: return name;
+    case 1: return dateOfBirth;
+    case 2: return ssn;
+    case 3: return salary;
+    case 4: return boss;
+    case 5: return webpage;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
   
   // Used by DatumReader.  Applications should not call. 
+  @SuppressWarnings(value="unchecked")
   public void put(int field$, java.lang.Object value) {
     switch (field$) {
-    case 0: __g__dirty = (java.nio.ByteBuffer)(value); break;
-    case 1: name = (java.lang.CharSequence)(value); break;
-    case 2: dateOfBirth = (java.lang.Long)(value); break;
-    case 3: ssn = (java.lang.CharSequence)(value); break;
-    case 4: salary = (java.lang.Integer)(value); break;
-    case 5: boss = (java.lang.Object)(value); break;
-    case 6: webpage = (org.apache.gora.examples.generated.WebPage)(value); break;
+    case 0: name = (java.lang.CharSequence)(value); break;
+    case 1: dateOfBirth = (java.lang.Long)(value); break;
+    case 2: ssn = (java.lang.CharSequence)(value); break;
+    case 3: salary = (java.lang.Integer)(value); break;
+    case 4: boss = (java.lang.Object)(value); break;
+    case 5: webpage = (org.apache.gora.examples.generated.WebPage)(value); break;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -114,7 +117,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setName(java.lang.CharSequence value) {
     this.name = value;
-    setDirty(1);
+    setDirty(0);
   }
   
   /**
@@ -122,7 +125,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isNameDirty(java.lang.CharSequence value) {
-    return isDirty(1);
+    return isDirty(0);
   }
 
   /**
@@ -138,7 +141,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setDateOfBirth(java.lang.Long value) {
     this.dateOfBirth = value;
-    setDirty(2);
+    setDirty(1);
   }
   
   /**
@@ -146,7 +149,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isDateOfBirthDirty(java.lang.Long value) {
-    return isDirty(2);
+    return isDirty(1);
   }
 
   /**
@@ -162,7 +165,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setSsn(java.lang.CharSequence value) {
     this.ssn = value;
-    setDirty(3);
+    setDirty(2);
   }
   
   /**
@@ -170,7 +173,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isSsnDirty(java.lang.CharSequence value) {
-    return isDirty(3);
+    return isDirty(2);
   }
 
   /**
@@ -186,7 +189,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setSalary(java.lang.Integer value) {
     this.salary = value;
-    setDirty(4);
+    setDirty(3);
   }
   
   /**
@@ -194,7 +197,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isSalaryDirty(java.lang.Integer value) {
-    return isDirty(4);
+    return isDirty(3);
   }
 
   /**
@@ -210,7 +213,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setBoss(java.lang.Object value) {
     this.boss = value;
-    setDirty(5);
+    setDirty(4);
   }
   
   /**
@@ -218,7 +221,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isBossDirty(java.lang.Object value) {
-    return isDirty(5);
+    return isDirty(4);
   }
 
   /**
@@ -234,7 +237,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setWebpage(org.apache.gora.examples.generated.WebPage value) {
     this.webpage = value;
-    setDirty(6);
+    setDirty(5);
   }
   
   /**
@@ -242,7 +245,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isWebpageDirty(org.apache.gora.examples.generated.WebPage value) {
-    return isDirty(6);
+    return isDirty(5);
   }
 
   /** Creates a new Employee RecordBuilder */
@@ -260,7 +263,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     return new org.apache.gora.examples.generated.Employee.Builder(other);
   }
   
-  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+  private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
       java.nio.ByteBuffer input) {
     java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
     int position = input.position();
@@ -289,7 +292,6 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Employee>
     implements org.apache.avro.data.RecordBuilder<Employee> {
 
-    private java.nio.ByteBuffer __g__dirty;
     private java.lang.CharSequence name;
     private long dateOfBirth;
     private java.lang.CharSequence ssn;
@@ -310,34 +312,30 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     /** Creates a Builder by copying an existing Employee instance */
     private Builder(org.apache.gora.examples.generated.Employee other) {
             super(org.apache.gora.examples.generated.Employee.SCHEMA$);
-      if (isValidValue(fields()[0], other.__g__dirty)) {
-        this.__g__dirty = (java.nio.ByteBuffer) data().deepCopy(fields()[0].schema(), other.__g__dirty);
+      if (isValidValue(fields()[0], other.name)) {
+        this.name = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.name);
         fieldSetFlags()[0] = true;
       }
-      if (isValidValue(fields()[1], other.name)) {
-        this.name = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.name);
+      if (isValidValue(fields()[1], other.dateOfBirth)) {
+        this.dateOfBirth = (java.lang.Long) data().deepCopy(fields()[1].schema(), other.dateOfBirth);
         fieldSetFlags()[1] = true;
       }
-      if (isValidValue(fields()[2], other.dateOfBirth)) {
-        this.dateOfBirth = (java.lang.Long) data().deepCopy(fields()[2].schema(), other.dateOfBirth);
+      if (isValidValue(fields()[2], other.ssn)) {
+        this.ssn = (java.lang.CharSequence) data().deepCopy(fields()[2].schema(), other.ssn);
         fieldSetFlags()[2] = true;
       }
-      if (isValidValue(fields()[3], other.ssn)) {
-        this.ssn = (java.lang.CharSequence) data().deepCopy(fields()[3].schema(), other.ssn);
+      if (isValidValue(fields()[3], other.salary)) {
+        this.salary = (java.lang.Integer) data().deepCopy(fields()[3].schema(), other.salary);
         fieldSetFlags()[3] = true;
       }
-      if (isValidValue(fields()[4], other.salary)) {
-        this.salary = (java.lang.Integer) data().deepCopy(fields()[4].schema(), other.salary);
+      if (isValidValue(fields()[4], other.boss)) {
+        this.boss = (java.lang.Object) data().deepCopy(fields()[4].schema(), other.boss);
         fieldSetFlags()[4] = true;
       }
-      if (isValidValue(fields()[5], other.boss)) {
-        this.boss = (java.lang.Object) data().deepCopy(fields()[5].schema(), other.boss);
+      if (isValidValue(fields()[5], other.webpage)) {
+        this.webpage = (org.apache.gora.examples.generated.WebPage) data().deepCopy(fields()[5].schema(), other.webpage);
         fieldSetFlags()[5] = true;
       }
-      if (isValidValue(fields()[6], other.webpage)) {
-        this.webpage = (org.apache.gora.examples.generated.WebPage) data().deepCopy(fields()[6].schema(), other.webpage);
-        fieldSetFlags()[6] = true;
-      }
     }
 
     /** Gets the value of the 'name' field */
@@ -347,21 +345,21 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'name' field */
     public org.apache.gora.examples.generated.Employee.Builder setName(java.lang.CharSequence value) {
-      validate(fields()[1], value);
+      validate(fields()[0], value);
       this.name = value;
-      fieldSetFlags()[1] = true;
+      fieldSetFlags()[0] = true;
       return this; 
     }
     
     /** Checks whether the 'name' field has been set */
     public boolean hasName() {
-      return fieldSetFlags()[1];
+      return fieldSetFlags()[0];
     }
     
     /** Clears the value of the 'name' field */
     public org.apache.gora.examples.generated.Employee.Builder clearName() {
       name = null;
-      fieldSetFlags()[1] = false;
+      fieldSetFlags()[0] = false;
       return this;
     }
     
@@ -372,20 +370,20 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'dateOfBirth' field */
     public org.apache.gora.examples.generated.Employee.Builder setDateOfBirth(long value) {
-      validate(fields()[2], value);
+      validate(fields()[1], value);
       this.dateOfBirth = value;
-      fieldSetFlags()[2] = true;
+      fieldSetFlags()[1] = true;
       return this; 
     }
     
     /** Checks whether the 'dateOfBirth' field has been set */
     public boolean hasDateOfBirth() {
-      return fieldSetFlags()[2];
+      return fieldSetFlags()[1];
     }
     
     /** Clears the value of the 'dateOfBirth' field */
     public org.apache.gora.examples.generated.Employee.Builder clearDateOfBirth() {
-      fieldSetFlags()[2] = false;
+      fieldSetFlags()[1] = false;
       return this;
     }
     
@@ -396,21 +394,21 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'ssn' field */
     public org.apache.gora.examples.generated.Employee.Builder setSsn(java.lang.CharSequence value) {
-      validate(fields()[3], value);
+      validate(fields()[2], value);
       this.ssn = value;
-      fieldSetFlags()[3] = true;
+      fieldSetFlags()[2] = true;
       return this; 
     }
     
     /** Checks whether the 'ssn' field has been set */
     public boolean hasSsn() {
-      return fieldSetFlags()[3];
+      return fieldSetFlags()[2];
     }
     
     /** Clears the value of the 'ssn' field */
     public org.apache.gora.examples.generated.Employee.Builder clearSsn() {
       ssn = null;
-      fieldSetFlags()[3] = false;
+      fieldSetFlags()[2] = false;
       return this;
     }
     
@@ -421,20 +419,20 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'salary' field */
     public org.apache.gora.examples.generated.Employee.Builder setSalary(int value) {
-      validate(fields()[4], value);
+      validate(fields()[3], value);
       this.salary = value;
-      fieldSetFlags()[4] = true;
+      fieldSetFlags()[3] = true;
       return this; 
     }
     
     /** Checks whether the 'salary' field has been set */
     public boolean hasSalary() {
-      return fieldSetFlags()[4];
+      return fieldSetFlags()[3];
     }
     
     /** Clears the value of the 'salary' field */
     public org.apache.gora.examples.generated.Employee.Builder clearSalary() {
-      fieldSetFlags()[4] = false;
+      fieldSetFlags()[3] = false;
       return this;
     }
     
@@ -445,21 +443,21 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'boss' field */
     public org.apache.gora.examples.generated.Employee.Builder setBoss(java.lang.Object value) {
-      validate(fields()[5], value);
+      validate(fields()[4], value);
       this.boss = value;
-      fieldSetFlags()[5] = true;
+      fieldSetFlags()[4] = true;
       return this; 
     }
     
     /** Checks whether the 'boss' field has been set */
     public boolean hasBoss() {
-      return fieldSetFlags()[5];
+      return fieldSetFlags()[4];
     }
     
     /** Clears the value of the 'boss' field */
     public org.apache.gora.examples.generated.Employee.Builder clearBoss() {
       boss = null;
-      fieldSetFlags()[5] = false;
+      fieldSetFlags()[4] = false;
       return this;
     }
     
@@ -470,21 +468,21 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'webpage' field */
     public org.apache.gora.examples.generated.Employee.Builder setWebpage(org.apache.gora.examples.generated.WebPage value) {
-      validate(fields()[6], value);
+      validate(fields()[5], value);
       this.webpage = value;
-      fieldSetFlags()[6] = true;
+      fieldSetFlags()[5] = true;
       return this; 
     }
     
     /** Checks whether the 'webpage' field has been set */
     public boolean hasWebpage() {
-      return fieldSetFlags()[6];
+      return fieldSetFlags()[5];
     }
     
     /** Clears the value of the 'webpage' field */
     public org.apache.gora.examples.generated.Employee.Builder clearWebpage() {
       webpage = null;
-      fieldSetFlags()[6] = false;
+      fieldSetFlags()[5] = false;
       return this;
     }
     
@@ -492,13 +490,12 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
     public Employee build() {
       try {
         Employee record = new Employee();
-        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer) java.nio.ByteBuffer.wrap(new byte[1]);
-        record.name = fieldSetFlags()[1] ? this.name : (java.lang.CharSequence) defaultValue(fields()[1]);
-        record.dateOfBirth = fieldSetFlags()[2] ? this.dateOfBirth : (java.lang.Long) defaultValue(fields()[2]);
-        record.ssn = fieldSetFlags()[3] ? this.ssn : (java.lang.CharSequence) defaultValue(fields()[3]);
-        record.salary = fieldSetFlags()[4] ? this.salary : (java.lang.Integer) defaultValue(fields()[4]);
-        record.boss = fieldSetFlags()[5] ? this.boss : (java.lang.Object) defaultValue(fields()[5]);
-        record.webpage = fieldSetFlags()[6] ? this.webpage : (org.apache.gora.examples.generated.WebPage) defaultValue(fields()[6]);
+        record.name = fieldSetFlags()[0] ? this.name : (java.lang.CharSequence) defaultValue(fields()[0]);
+        record.dateOfBirth = fieldSetFlags()[1] ? this.dateOfBirth : (java.lang.Long) defaultValue(fields()[1]);
+        record.ssn = fieldSetFlags()[2] ? this.ssn : (java.lang.CharSequence) defaultValue(fields()[2]);
+        record.salary = fieldSetFlags()[3] ? this.salary : (java.lang.Integer) defaultValue(fields()[3]);
+        record.boss = fieldSetFlags()[4] ? this.boss : (java.lang.Object) defaultValue(fields()[4]);
+        record.webpage = fieldSetFlags()[5] ? this.webpage : (org.apache.gora.examples.generated.WebPage) defaultValue(fields()[5]);
         return record;
       } catch (Exception e) {
         throw new org.apache.avro.AvroRuntimeException(e);
@@ -520,7 +517,7 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
   
       private Tombstone() { }
   
-	  				  /**
+	  		  /**
 	   * Gets the value of the 'name' field.
 		   */
 	  public java.lang.CharSequence getName() {
@@ -661,4 +658,5 @@ public class Employee extends org.apache.gora.persistency.impl.PersistentBase im
 		  
   }
   
-}
\ No newline at end of file
+}
+

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java b/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
index c36a4c0..85294bf 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
@@ -7,13 +7,12 @@ package org.apache.gora.examples.generated;
 @SuppressWarnings("all")
 /** Record with only immutable or dirtyable fields, used for testing */
 public class ImmutableFields extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ImmutableFields\",\"namespace\":\"org.apache.gora.examples.generated\",\"doc\":\"Record with only immutable or dirtyable fields, used for testing\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"v1\",\"type\":\"int\",\"default\":0},{\"name\":\"v2\",\"type\":[{\"type\":\"record\",\"name\":\"V2\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"v3\",\"type\":\"int\",\"default\":0}]},\"null\"],\"default\":null}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ImmutableFields\",\"namespace\":\"org.apache.gora.examples.generated\",\"doc\":\"Record with only immutable or dirtyable fields, used for testing\",\"fields\":[{\"name\":\"v1\",\"type\":\"int\",\"default\":0},{\"name\":\"v2\",\"type\":[{\"type\":\"record\",\"name\":\"V2\",\"fields\":[{\"name\":\"v3\",\"type\":\"int\",\"default\":0}]},\"null\"],\"default\":null}]}");
 
   /** Enum containing all data bean's fields. */
   public static enum Field {
-    __G__DIRTY(0, "__g__dirty"),
-    V1(1, "v1"),
-    V2(2, "v2"),
+    V1(0, "v1"),
+    V2(1, "v2"),
     ;
     /**
      * Field's index.
@@ -52,22 +51,26 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
   };
 
   public static final String[] _ALL_FIELDS = {
-  "__g__dirty",
   "v1",
   "v2",
   };
 
-  /** Bytes used to represent weather or not a field is dirty. */
-  private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
+  /**
+   * Gets the total field count.
+   * @return int field count
+   */
+  public int getFieldsCount() {
+    return ImmutableFields._ALL_FIELDS.length;
+  }
+
   private int v1;
   private org.apache.gora.examples.generated.V2 v2;
   public org.apache.avro.Schema getSchema() { return SCHEMA$; }
   // Used by DatumWriter.  Applications should not call. 
   public java.lang.Object get(int field$) {
     switch (field$) {
-    case 0: return __g__dirty;
-    case 1: return v1;
-    case 2: return v2;
+    case 0: return v1;
+    case 1: return v2;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -76,9 +79,8 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
   @SuppressWarnings(value="unchecked")
   public void put(int field$, java.lang.Object value) {
     switch (field$) {
-    case 0: __g__dirty = (java.nio.ByteBuffer)(value); break;
-    case 1: v1 = (java.lang.Integer)(value); break;
-    case 2: v2 = (org.apache.gora.examples.generated.V2)(value); break;
+    case 0: v1 = (java.lang.Integer)(value); break;
+    case 1: v2 = (org.apache.gora.examples.generated.V2)(value); break;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -96,7 +98,7 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
    */
   public void setV1(java.lang.Integer value) {
     this.v1 = value;
-    setDirty(1);
+    setDirty(0);
   }
   
   /**
@@ -104,7 +106,7 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
    * @param value the value to set.
    */
   public boolean isV1Dirty(java.lang.Integer value) {
-    return isDirty(1);
+    return isDirty(0);
   }
 
   /**
@@ -120,7 +122,7 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
    */
   public void setV2(org.apache.gora.examples.generated.V2 value) {
     this.v2 = value;
-    setDirty(2);
+    setDirty(1);
   }
   
   /**
@@ -128,7 +130,7 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
    * @param value the value to set.
    */
   public boolean isV2Dirty(org.apache.gora.examples.generated.V2 value) {
-    return isDirty(2);
+    return isDirty(1);
   }
 
   /** Creates a new ImmutableFields RecordBuilder */
@@ -146,7 +148,7 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
     return new org.apache.gora.examples.generated.ImmutableFields.Builder(other);
   }
   
-  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+  private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
       java.nio.ByteBuffer input) {
     java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
     int position = input.position();
@@ -175,7 +177,6 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ImmutableFields>
     implements org.apache.avro.data.RecordBuilder<ImmutableFields> {
 
-    private java.nio.ByteBuffer __g__dirty;
     private int v1;
     private org.apache.gora.examples.generated.V2 v2;
 
@@ -192,18 +193,14 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
     /** Creates a Builder by copying an existing ImmutableFields instance */
     private Builder(org.apache.gora.examples.generated.ImmutableFields other) {
             super(org.apache.gora.examples.generated.ImmutableFields.SCHEMA$);
-      if (isValidValue(fields()[0], other.__g__dirty)) {
-        this.__g__dirty = (java.nio.ByteBuffer) data().deepCopy(fields()[0].schema(), other.__g__dirty);
+      if (isValidValue(fields()[0], other.v1)) {
+        this.v1 = (java.lang.Integer) data().deepCopy(fields()[0].schema(), other.v1);
         fieldSetFlags()[0] = true;
       }
-      if (isValidValue(fields()[1], other.v1)) {
-        this.v1 = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.v1);
+      if (isValidValue(fields()[1], other.v2)) {
+        this.v2 = (org.apache.gora.examples.generated.V2) data().deepCopy(fields()[1].schema(), other.v2);
         fieldSetFlags()[1] = true;
       }
-      if (isValidValue(fields()[2], other.v2)) {
-        this.v2 = (org.apache.gora.examples.generated.V2) data().deepCopy(fields()[2].schema(), other.v2);
-        fieldSetFlags()[2] = true;
-      }
     }
 
     /** Gets the value of the 'v1' field */
@@ -213,20 +210,20 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
     
     /** Sets the value of the 'v1' field */
     public org.apache.gora.examples.generated.ImmutableFields.Builder setV1(int value) {
-      validate(fields()[1], value);
+      validate(fields()[0], value);
       this.v1 = value;
-      fieldSetFlags()[1] = true;
+      fieldSetFlags()[0] = true;
       return this; 
     }
     
     /** Checks whether the 'v1' field has been set */
     public boolean hasV1() {
-      return fieldSetFlags()[1];
+      return fieldSetFlags()[0];
     }
     
     /** Clears the value of the 'v1' field */
     public org.apache.gora.examples.generated.ImmutableFields.Builder clearV1() {
-      fieldSetFlags()[1] = false;
+      fieldSetFlags()[0] = false;
       return this;
     }
     
@@ -237,21 +234,21 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
     
     /** Sets the value of the 'v2' field */
     public org.apache.gora.examples.generated.ImmutableFields.Builder setV2(org.apache.gora.examples.generated.V2 value) {
-      validate(fields()[2], value);
+      validate(fields()[1], value);
       this.v2 = value;
-      fieldSetFlags()[2] = true;
+      fieldSetFlags()[1] = true;
       return this; 
     }
     
     /** Checks whether the 'v2' field has been set */
     public boolean hasV2() {
-      return fieldSetFlags()[2];
+      return fieldSetFlags()[1];
     }
     
     /** Clears the value of the 'v2' field */
     public org.apache.gora.examples.generated.ImmutableFields.Builder clearV2() {
       v2 = null;
-      fieldSetFlags()[2] = false;
+      fieldSetFlags()[1] = false;
       return this;
     }
     
@@ -259,9 +256,8 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
     public ImmutableFields build() {
       try {
         ImmutableFields record = new ImmutableFields();
-        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer) java.nio.ByteBuffer.wrap(new byte[1]);
-        record.v1 = fieldSetFlags()[1] ? this.v1 : (java.lang.Integer) defaultValue(fields()[1]);
-        record.v2 = fieldSetFlags()[2] ? this.v2 : (org.apache.gora.examples.generated.V2) defaultValue(fields()[2]);
+        record.v1 = fieldSetFlags()[0] ? this.v1 : (java.lang.Integer) defaultValue(fields()[0]);
+        record.v2 = fieldSetFlags()[1] ? this.v2 : (org.apache.gora.examples.generated.V2) defaultValue(fields()[1]);
         return record;
       } catch (Exception e) {
         throw new org.apache.avro.AvroRuntimeException(e);
@@ -283,7 +279,7 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
   
       private Tombstone() { }
   
-	  				  /**
+	  		  /**
 	   * Gets the value of the 'v1' field.
 		   */
 	  public java.lang.Integer getV1() {
@@ -332,4 +328,5 @@ public class ImmutableFields extends org.apache.gora.persistency.impl.Persistent
 		  
   }
   
-}
\ No newline at end of file
+}
+

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java b/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
index 8de390f..3eb7b32 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/Metadata.java
@@ -6,13 +6,12 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class Metadata extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Metadata\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Metadata\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]}");
 
   /** Enum containing all data bean's fields. */
   public static enum Field {
-    __G__DIRTY(0, "__g__dirty"),
-    VERSION(1, "version"),
-    DATA(2, "data"),
+    VERSION(0, "version"),
+    DATA(1, "data"),
     ;
     /**
      * Field's index.
@@ -51,22 +50,26 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
   };
 
   public static final String[] _ALL_FIELDS = {
-  "__g__dirty",
   "version",
   "data",
   };
 
-  /** Bytes used to represent weather or not a field is dirty. */
-  private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
+  /**
+   * Gets the total field count.
+   * @return int field count
+   */
+  public int getFieldsCount() {
+    return Metadata._ALL_FIELDS.length;
+  }
+
   private int version;
   private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> data;
   public org.apache.avro.Schema getSchema() { return SCHEMA$; }
   // Used by DatumWriter.  Applications should not call. 
   public java.lang.Object get(int field$) {
     switch (field$) {
-    case 0: return __g__dirty;
-    case 1: return version;
-    case 2: return data;
+    case 0: return version;
+    case 1: return data;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -75,9 +78,8 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
   @SuppressWarnings(value="unchecked")
   public void put(int field$, java.lang.Object value) {
     switch (field$) {
-    case 0: __g__dirty = (java.nio.ByteBuffer)(value); break;
-    case 1: version = (java.lang.Integer)(value); break;
-    case 2: data = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break;
+    case 0: version = (java.lang.Integer)(value); break;
+    case 1: data = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -95,7 +97,7 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setVersion(java.lang.Integer value) {
     this.version = value;
-    setDirty(1);
+    setDirty(0);
   }
   
   /**
@@ -103,7 +105,7 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isVersionDirty(java.lang.Integer value) {
-    return isDirty(1);
+    return isDirty(0);
   }
 
   /**
@@ -119,7 +121,7 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
    */
   public void setData(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
     this.data = (value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper(value);
-    setDirty(2);
+    setDirty(1);
   }
   
   /**
@@ -127,7 +129,7 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
    * @param value the value to set.
    */
   public boolean isDataDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
-    return isDirty(2);
+    return isDirty(1);
   }
 
   /** Creates a new Metadata RecordBuilder */
@@ -145,7 +147,7 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
     return new org.apache.gora.examples.generated.Metadata.Builder(other);
   }
   
-  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+  private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
       java.nio.ByteBuffer input) {
     java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
     int position = input.position();
@@ -174,7 +176,6 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Metadata>
     implements org.apache.avro.data.RecordBuilder<Metadata> {
 
-    private java.nio.ByteBuffer __g__dirty;
     private int version;
     private java.util.Map<java.lang.CharSequence,java.lang.CharSequence> data;
 
@@ -191,18 +192,14 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
     /** Creates a Builder by copying an existing Metadata instance */
     private Builder(org.apache.gora.examples.generated.Metadata other) {
             super(org.apache.gora.examples.generated.Metadata.SCHEMA$);
-      if (isValidValue(fields()[0], other.__g__dirty)) {
-        this.__g__dirty = (java.nio.ByteBuffer) data().deepCopy(fields()[0].schema(), other.__g__dirty);
+      if (isValidValue(fields()[0], other.version)) {
+        this.version = (java.lang.Integer) data().deepCopy(fields()[0].schema(), other.version);
         fieldSetFlags()[0] = true;
       }
-      if (isValidValue(fields()[1], other.version)) {
-        this.version = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.version);
+      if (isValidValue(fields()[1], other.data)) {
+        this.data = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[1].schema(), other.data);
         fieldSetFlags()[1] = true;
       }
-      if (isValidValue(fields()[2], other.data)) {
-        this.data = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[2].schema(), other.data);
-        fieldSetFlags()[2] = true;
-      }
     }
 
     /** Gets the value of the 'version' field */
@@ -212,20 +209,20 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'version' field */
     public org.apache.gora.examples.generated.Metadata.Builder setVersion(int value) {
-      validate(fields()[1], value);
+      validate(fields()[0], value);
       this.version = value;
-      fieldSetFlags()[1] = true;
+      fieldSetFlags()[0] = true;
       return this; 
     }
     
     /** Checks whether the 'version' field has been set */
     public boolean hasVersion() {
-      return fieldSetFlags()[1];
+      return fieldSetFlags()[0];
     }
     
     /** Clears the value of the 'version' field */
     public org.apache.gora.examples.generated.Metadata.Builder clearVersion() {
-      fieldSetFlags()[1] = false;
+      fieldSetFlags()[0] = false;
       return this;
     }
     
@@ -236,21 +233,21 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
     
     /** Sets the value of the 'data' field */
     public org.apache.gora.examples.generated.Metadata.Builder setData(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
-      validate(fields()[2], value);
+      validate(fields()[1], value);
       this.data = value;
-      fieldSetFlags()[2] = true;
+      fieldSetFlags()[1] = true;
       return this; 
     }
     
     /** Checks whether the 'data' field has been set */
     public boolean hasData() {
-      return fieldSetFlags()[2];
+      return fieldSetFlags()[1];
     }
     
     /** Clears the value of the 'data' field */
     public org.apache.gora.examples.generated.Metadata.Builder clearData() {
       data = null;
-      fieldSetFlags()[2] = false;
+      fieldSetFlags()[1] = false;
       return this;
     }
     
@@ -258,9 +255,8 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
     public Metadata build() {
       try {
         Metadata record = new Metadata();
-        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer) java.nio.ByteBuffer.wrap(new byte[1]);
-        record.version = fieldSetFlags()[1] ? this.version : (java.lang.Integer) defaultValue(fields()[1]);
-        record.data = fieldSetFlags()[2] ? this.data : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[2]));
+        record.version = fieldSetFlags()[0] ? this.version : (java.lang.Integer) defaultValue(fields()[0]);
+        record.data = fieldSetFlags()[1] ? this.data : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[1]));
         return record;
       } catch (Exception e) {
         throw new org.apache.avro.AvroRuntimeException(e);
@@ -282,7 +278,7 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
   
       private Tombstone() { }
   
-	  				  /**
+	  		  /**
 	   * Gets the value of the 'version' field.
 		   */
 	  public java.lang.Integer getVersion() {
@@ -331,4 +327,5 @@ public class Metadata extends org.apache.gora.persistency.impl.PersistentBase im
 		  
   }
   
-}
\ No newline at end of file
+}
+

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java b/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
index 70d8b3f..e38d640 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/TokenDatum.java
@@ -6,12 +6,11 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TokenDatum\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"count\",\"type\":\"int\",\"default\":0}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TokenDatum\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"count\",\"type\":\"int\",\"default\":0}]}");
 
   /** Enum containing all data bean's fields. */
   public static enum Field {
-    __G__DIRTY(0, "__g__dirty"),
-    COUNT(1, "count"),
+    COUNT(0, "count"),
     ;
     /**
      * Field's index.
@@ -50,19 +49,23 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
   };
 
   public static final String[] _ALL_FIELDS = {
-  "__g__dirty",
   "count",
   };
 
-  /** Bytes used to represent weather or not a field is dirty. */
-  private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
+  /**
+   * Gets the total field count.
+   * @return int field count
+   */
+  public int getFieldsCount() {
+    return TokenDatum._ALL_FIELDS.length;
+  }
+
   private int count;
   public org.apache.avro.Schema getSchema() { return SCHEMA$; }
   // Used by DatumWriter.  Applications should not call. 
   public java.lang.Object get(int field$) {
     switch (field$) {
-    case 0: return __g__dirty;
-    case 1: return count;
+    case 0: return count;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -71,8 +74,7 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
   @SuppressWarnings(value="unchecked")
   public void put(int field$, java.lang.Object value) {
     switch (field$) {
-    case 0: __g__dirty = (java.nio.ByteBuffer)(value); break;
-    case 1: count = (java.lang.Integer)(value); break;
+    case 0: count = (java.lang.Integer)(value); break;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -90,7 +92,7 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
    */
   public void setCount(java.lang.Integer value) {
     this.count = value;
-    setDirty(1);
+    setDirty(0);
   }
   
   /**
@@ -98,7 +100,7 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
    * @param value the value to set.
    */
   public boolean isCountDirty(java.lang.Integer value) {
-    return isDirty(1);
+    return isDirty(0);
   }
 
   /** Creates a new TokenDatum RecordBuilder */
@@ -116,7 +118,7 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
     return new org.apache.gora.examples.generated.TokenDatum.Builder(other);
   }
   
-  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+  private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
       java.nio.ByteBuffer input) {
     java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
     int position = input.position();
@@ -145,7 +147,6 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<TokenDatum>
     implements org.apache.avro.data.RecordBuilder<TokenDatum> {
 
-    private java.nio.ByteBuffer __g__dirty;
     private int count;
 
     /** Creates a new Builder */
@@ -161,14 +162,10 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
     /** Creates a Builder by copying an existing TokenDatum instance */
     private Builder(org.apache.gora.examples.generated.TokenDatum other) {
             super(org.apache.gora.examples.generated.TokenDatum.SCHEMA$);
-      if (isValidValue(fields()[0], other.__g__dirty)) {
-        this.__g__dirty = (java.nio.ByteBuffer) data().deepCopy(fields()[0].schema(), other.__g__dirty);
+      if (isValidValue(fields()[0], other.count)) {
+        this.count = (java.lang.Integer) data().deepCopy(fields()[0].schema(), other.count);
         fieldSetFlags()[0] = true;
       }
-      if (isValidValue(fields()[1], other.count)) {
-        this.count = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.count);
-        fieldSetFlags()[1] = true;
-      }
     }
 
     /** Gets the value of the 'count' field */
@@ -178,20 +175,20 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
     
     /** Sets the value of the 'count' field */
     public org.apache.gora.examples.generated.TokenDatum.Builder setCount(int value) {
-      validate(fields()[1], value);
+      validate(fields()[0], value);
       this.count = value;
-      fieldSetFlags()[1] = true;
+      fieldSetFlags()[0] = true;
       return this; 
     }
     
     /** Checks whether the 'count' field has been set */
     public boolean hasCount() {
-      return fieldSetFlags()[1];
+      return fieldSetFlags()[0];
     }
     
     /** Clears the value of the 'count' field */
     public org.apache.gora.examples.generated.TokenDatum.Builder clearCount() {
-      fieldSetFlags()[1] = false;
+      fieldSetFlags()[0] = false;
       return this;
     }
     
@@ -199,8 +196,7 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
     public TokenDatum build() {
       try {
         TokenDatum record = new TokenDatum();
-        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer) java.nio.ByteBuffer.wrap(new byte[1]);
-        record.count = fieldSetFlags()[1] ? this.count : (java.lang.Integer) defaultValue(fields()[1]);
+        record.count = fieldSetFlags()[0] ? this.count : (java.lang.Integer) defaultValue(fields()[0]);
         return record;
       } catch (Exception e) {
         throw new org.apache.avro.AvroRuntimeException(e);
@@ -222,7 +218,7 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
   
       private Tombstone() { }
   
-	  				  /**
+	  		  /**
 	   * Gets the value of the 'count' field.
 		   */
 	  public java.lang.Integer getCount() {
@@ -248,4 +244,5 @@ public class TokenDatum extends org.apache.gora.persistency.impl.PersistentBase
 		  
   }
   
-}
\ No newline at end of file
+}
+

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java b/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
index 9cccc1a..1db2a0b 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
@@ -6,12 +6,11 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class V2 extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"V2\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"v3\",\"type\":\"int\",\"default\":0}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"V2\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"v3\",\"type\":\"int\",\"default\":0}]}");
 
   /** Enum containing all data bean's fields. */
   public static enum Field {
-    __G__DIRTY(0, "__g__dirty"),
-    V3(1, "v3"),
+    V3(0, "v3"),
     ;
     /**
      * Field's index.
@@ -50,19 +49,23 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
   };
 
   public static final String[] _ALL_FIELDS = {
-  "__g__dirty",
   "v3",
   };
 
-  /** Bytes used to represent weather or not a field is dirty. */
-  private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
+  /**
+   * Gets the total field count.
+   * @return int field count
+   */
+  public int getFieldsCount() {
+    return V2._ALL_FIELDS.length;
+  }
+
   private int v3;
   public org.apache.avro.Schema getSchema() { return SCHEMA$; }
   // Used by DatumWriter.  Applications should not call. 
   public java.lang.Object get(int field$) {
     switch (field$) {
-    case 0: return __g__dirty;
-    case 1: return v3;
+    case 0: return v3;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -71,8 +74,7 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
   @SuppressWarnings(value="unchecked")
   public void put(int field$, java.lang.Object value) {
     switch (field$) {
-    case 0: __g__dirty = (java.nio.ByteBuffer)(value); break;
-    case 1: v3 = (java.lang.Integer)(value); break;
+    case 0: v3 = (java.lang.Integer)(value); break;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -90,7 +92,7 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
    */
   public void setV3(java.lang.Integer value) {
     this.v3 = value;
-    setDirty(1);
+    setDirty(0);
   }
   
   /**
@@ -98,7 +100,7 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
    * @param value the value to set.
    */
   public boolean isV3Dirty(java.lang.Integer value) {
-    return isDirty(1);
+    return isDirty(0);
   }
 
   /** Creates a new V2 RecordBuilder */
@@ -116,7 +118,7 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
     return new org.apache.gora.examples.generated.V2.Builder(other);
   }
   
-  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+  private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
       java.nio.ByteBuffer input) {
     java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
     int position = input.position();
@@ -145,7 +147,6 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<V2>
     implements org.apache.avro.data.RecordBuilder<V2> {
 
-    private java.nio.ByteBuffer __g__dirty;
     private int v3;
 
     /** Creates a new Builder */
@@ -161,14 +162,10 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
     /** Creates a Builder by copying an existing V2 instance */
     private Builder(org.apache.gora.examples.generated.V2 other) {
             super(org.apache.gora.examples.generated.V2.SCHEMA$);
-      if (isValidValue(fields()[0], other.__g__dirty)) {
-        this.__g__dirty = (java.nio.ByteBuffer) data().deepCopy(fields()[0].schema(), other.__g__dirty);
+      if (isValidValue(fields()[0], other.v3)) {
+        this.v3 = (java.lang.Integer) data().deepCopy(fields()[0].schema(), other.v3);
         fieldSetFlags()[0] = true;
       }
-      if (isValidValue(fields()[1], other.v3)) {
-        this.v3 = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.v3);
-        fieldSetFlags()[1] = true;
-      }
     }
 
     /** Gets the value of the 'v3' field */
@@ -178,20 +175,20 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
     
     /** Sets the value of the 'v3' field */
     public org.apache.gora.examples.generated.V2.Builder setV3(int value) {
-      validate(fields()[1], value);
+      validate(fields()[0], value);
       this.v3 = value;
-      fieldSetFlags()[1] = true;
+      fieldSetFlags()[0] = true;
       return this; 
     }
     
     /** Checks whether the 'v3' field has been set */
     public boolean hasV3() {
-      return fieldSetFlags()[1];
+      return fieldSetFlags()[0];
     }
     
     /** Clears the value of the 'v3' field */
     public org.apache.gora.examples.generated.V2.Builder clearV3() {
-      fieldSetFlags()[1] = false;
+      fieldSetFlags()[0] = false;
       return this;
     }
     
@@ -199,8 +196,7 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
     public V2 build() {
       try {
         V2 record = new V2();
-        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer) java.nio.ByteBuffer.wrap(new byte[1]);
-        record.v3 = fieldSetFlags()[1] ? this.v3 : (java.lang.Integer) defaultValue(fields()[1]);
+        record.v3 = fieldSetFlags()[0] ? this.v3 : (java.lang.Integer) defaultValue(fields()[0]);
         return record;
       } catch (Exception e) {
         throw new org.apache.avro.AvroRuntimeException(e);
@@ -222,7 +218,7 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
   
       private Tombstone() { }
   
-	  				  /**
+	  		  /**
 	   * Gets the value of the 'v3' field.
 		   */
 	  public java.lang.Integer getV3() {
@@ -248,4 +244,5 @@ public class V2 extends org.apache.gora.persistency.impl.PersistentBase implemen
 		  
   }
   
-}
\ No newline at end of file
+}
+

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java b/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
index 44b3e0a..604b560 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/WebPage.java
@@ -6,17 +6,16 @@
 package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
 public class WebPage extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent {
-  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WebPage\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\"AA==\"},{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":{}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":[\"null\",\"string\"]},\"default\":{}},{\"name\":\"headers\",\"type\":[\"null\",{\"type\":\"map\",\"values\":[\"null\",\"string\"]}],\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"__g__dirty\",\"type\":\"bytes\",\"doc\":\"Bytes used to represent weather or not a field is dirty.\",\"default\":\
 "AA==\"},{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}}]},\"default\":null}]}");
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"WebPage\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"url\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"],\"default\":null},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"default\":null},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":{}},{\"name\":\"headers\",\"type\":[\"null\",{\"type\":\"map\",\"values\":[\"null\",\"string\"]}],\"default\":null},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"version\",\"type\":\"int\",\"default\":0},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"default\":null}]},\"default\":null}],\"default\":null}");
 
   /** Enum containing all data bean's fields. */
   public static enum Field {
-    __G__DIRTY(0, "__g__dirty"),
-    URL(1, "url"),
-    CONTENT(2, "content"),
-    PARSED_CONTENT(3, "parsedContent"),
-    OUTLINKS(4, "outlinks"),
-    HEADERS(5, "headers"),
-    METADATA(6, "metadata"),
+    URL(0, "url"),
+    CONTENT(1, "content"),
+    PARSED_CONTENT(2, "parsedContent"),
+    OUTLINKS(3, "outlinks"),
+    HEADERS(4, "headers"),
+    METADATA(5, "metadata"),
     ;
     /**
      * Field's index.
@@ -55,7 +54,6 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
   };
 
   public static final String[] _ALL_FIELDS = {
-  "__g__dirty",
   "url",
   "content",
   "parsedContent",
@@ -64,8 +62,14 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
   "metadata",
   };
 
-  /** Bytes used to represent weather or not a field is dirty. */
-  private java.nio.ByteBuffer __g__dirty = java.nio.ByteBuffer.wrap(new byte[1]);
+  /**
+   * Gets the total field count.
+   * @return int field count
+   */
+  public int getFieldsCount() {
+    return WebPage._ALL_FIELDS.length;
+  }
+
   private java.lang.CharSequence url;
   private java.nio.ByteBuffer content;
   private java.util.List<java.lang.CharSequence> parsedContent;
@@ -76,13 +80,12 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
   // Used by DatumWriter.  Applications should not call. 
   public java.lang.Object get(int field$) {
     switch (field$) {
-    case 0: return __g__dirty;
-    case 1: return url;
-    case 2: return content;
-    case 3: return parsedContent;
-    case 4: return outlinks;
-    case 5: return headers;
-    case 6: return metadata;
+    case 0: return url;
+    case 1: return content;
+    case 2: return parsedContent;
+    case 3: return outlinks;
+    case 4: return headers;
+    case 5: return metadata;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -91,13 +94,12 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
   @SuppressWarnings(value="unchecked")
   public void put(int field$, java.lang.Object value) {
     switch (field$) {
-    case 0: __g__dirty = (java.nio.ByteBuffer)(value); break;
-    case 1: url = (java.lang.CharSequence)(value); break;
-    case 2: content = (java.nio.ByteBuffer)(value); break;
-    case 3: parsedContent = (java.util.List<java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)value)); break;
-    case 4: outlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break;
-    case 5: headers = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)(value); break;
-    case 6: metadata = (org.apache.gora.examples.generated.Metadata)(value); break;
+    case 0: url = (java.lang.CharSequence)(value); break;
+    case 1: content = (java.nio.ByteBuffer)(value); break;
+    case 2: parsedContent = (java.util.List<java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)value)); break;
+    case 3: outlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)((value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)value)); break;
+    case 4: headers = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>)(value); break;
+    case 5: metadata = (org.apache.gora.examples.generated.Metadata)(value); break;
     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
     }
   }
@@ -115,7 +117,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    */
   public void setUrl(java.lang.CharSequence value) {
     this.url = value;
-    setDirty(1);
+    setDirty(0);
   }
   
   /**
@@ -123,7 +125,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    * @param value the value to set.
    */
   public boolean isUrlDirty(java.lang.CharSequence value) {
-    return isDirty(1);
+    return isDirty(0);
   }
 
   /**
@@ -139,7 +141,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    */
   public void setContent(java.nio.ByteBuffer value) {
     this.content = value;
-    setDirty(2);
+    setDirty(1);
   }
   
   /**
@@ -147,7 +149,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    * @param value the value to set.
    */
   public boolean isContentDirty(java.nio.ByteBuffer value) {
-    return isDirty(2);
+    return isDirty(1);
   }
 
   /**
@@ -163,7 +165,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    */
   public void setParsedContent(java.util.List<java.lang.CharSequence> value) {
     this.parsedContent = (value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyListWrapper(value);
-    setDirty(3);
+    setDirty(2);
   }
   
   /**
@@ -171,7 +173,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    * @param value the value to set.
    */
   public boolean isParsedContentDirty(java.util.List<java.lang.CharSequence> value) {
-    return isDirty(3);
+    return isDirty(2);
   }
 
   /**
@@ -187,7 +189,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    */
   public void setOutlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
     this.outlinks = (value instanceof org.apache.gora.persistency.Dirtyable) ? value : new org.apache.gora.persistency.impl.DirtyMapWrapper(value);
-    setDirty(4);
+    setDirty(3);
   }
   
   /**
@@ -195,7 +197,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    * @param value the value to set.
    */
   public boolean isOutlinksDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
-    return isDirty(4);
+    return isDirty(3);
   }
 
   /**
@@ -211,7 +213,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    */
   public void setHeaders(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
     this.headers = value;
-    setDirty(5);
+    setDirty(4);
   }
   
   /**
@@ -219,7 +221,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    * @param value the value to set.
    */
   public boolean isHeadersDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
-    return isDirty(5);
+    return isDirty(4);
   }
 
   /**
@@ -235,7 +237,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    */
   public void setMetadata(org.apache.gora.examples.generated.Metadata value) {
     this.metadata = value;
-    setDirty(6);
+    setDirty(5);
   }
   
   /**
@@ -243,7 +245,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
    * @param value the value to set.
    */
   public boolean isMetadataDirty(org.apache.gora.examples.generated.Metadata value) {
-    return isDirty(6);
+    return isDirty(5);
   }
 
   /** Creates a new WebPage RecordBuilder */
@@ -261,7 +263,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     return new org.apache.gora.examples.generated.WebPage.Builder(other);
   }
   
-  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+  private static java.nio.ByteBuffer deepCopyToReadOnlyBuffer(
       java.nio.ByteBuffer input) {
     java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
     int position = input.position();
@@ -290,7 +292,6 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<WebPage>
     implements org.apache.avro.data.RecordBuilder<WebPage> {
 
-    private java.nio.ByteBuffer __g__dirty;
     private java.lang.CharSequence url;
     private java.nio.ByteBuffer content;
     private java.util.List<java.lang.CharSequence> parsedContent;
@@ -311,34 +312,30 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     /** Creates a Builder by copying an existing WebPage instance */
     private Builder(org.apache.gora.examples.generated.WebPage other) {
             super(org.apache.gora.examples.generated.WebPage.SCHEMA$);
-      if (isValidValue(fields()[0], other.__g__dirty)) {
-        this.__g__dirty = (java.nio.ByteBuffer) data().deepCopy(fields()[0].schema(), other.__g__dirty);
+      if (isValidValue(fields()[0], other.url)) {
+        this.url = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.url);
         fieldSetFlags()[0] = true;
       }
-      if (isValidValue(fields()[1], other.url)) {
-        this.url = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.url);
+      if (isValidValue(fields()[1], other.content)) {
+        this.content = (java.nio.ByteBuffer) data().deepCopy(fields()[1].schema(), other.content);
         fieldSetFlags()[1] = true;
       }
-      if (isValidValue(fields()[2], other.content)) {
-        this.content = (java.nio.ByteBuffer) data().deepCopy(fields()[2].schema(), other.content);
+      if (isValidValue(fields()[2], other.parsedContent)) {
+        this.parsedContent = (java.util.List<java.lang.CharSequence>) data().deepCopy(fields()[2].schema(), other.parsedContent);
         fieldSetFlags()[2] = true;
       }
-      if (isValidValue(fields()[3], other.parsedContent)) {
-        this.parsedContent = (java.util.List<java.lang.CharSequence>) data().deepCopy(fields()[3].schema(), other.parsedContent);
+      if (isValidValue(fields()[3], other.outlinks)) {
+        this.outlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[3].schema(), other.outlinks);
         fieldSetFlags()[3] = true;
       }
-      if (isValidValue(fields()[4], other.outlinks)) {
-        this.outlinks = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[4].schema(), other.outlinks);
+      if (isValidValue(fields()[4], other.headers)) {
+        this.headers = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[4].schema(), other.headers);
         fieldSetFlags()[4] = true;
       }
-      if (isValidValue(fields()[5], other.headers)) {
-        this.headers = (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) data().deepCopy(fields()[5].schema(), other.headers);
+      if (isValidValue(fields()[5], other.metadata)) {
+        this.metadata = (org.apache.gora.examples.generated.Metadata) data().deepCopy(fields()[5].schema(), other.metadata);
         fieldSetFlags()[5] = true;
       }
-      if (isValidValue(fields()[6], other.metadata)) {
-        this.metadata = (org.apache.gora.examples.generated.Metadata) data().deepCopy(fields()[6].schema(), other.metadata);
-        fieldSetFlags()[6] = true;
-      }
     }
 
     /** Gets the value of the 'url' field */
@@ -348,21 +345,21 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     
     /** Sets the value of the 'url' field */
     public org.apache.gora.examples.generated.WebPage.Builder setUrl(java.lang.CharSequence value) {
-      validate(fields()[1], value);
+      validate(fields()[0], value);
       this.url = value;
-      fieldSetFlags()[1] = true;
+      fieldSetFlags()[0] = true;
       return this; 
     }
     
     /** Checks whether the 'url' field has been set */
     public boolean hasUrl() {
-      return fieldSetFlags()[1];
+      return fieldSetFlags()[0];
     }
     
     /** Clears the value of the 'url' field */
     public org.apache.gora.examples.generated.WebPage.Builder clearUrl() {
       url = null;
-      fieldSetFlags()[1] = false;
+      fieldSetFlags()[0] = false;
       return this;
     }
     
@@ -373,21 +370,21 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     
     /** Sets the value of the 'content' field */
     public org.apache.gora.examples.generated.WebPage.Builder setContent(java.nio.ByteBuffer value) {
-      validate(fields()[2], value);
+      validate(fields()[1], value);
       this.content = value;
-      fieldSetFlags()[2] = true;
+      fieldSetFlags()[1] = true;
       return this; 
     }
     
     /** Checks whether the 'content' field has been set */
     public boolean hasContent() {
-      return fieldSetFlags()[2];
+      return fieldSetFlags()[1];
     }
     
     /** Clears the value of the 'content' field */
     public org.apache.gora.examples.generated.WebPage.Builder clearContent() {
       content = null;
-      fieldSetFlags()[2] = false;
+      fieldSetFlags()[1] = false;
       return this;
     }
     
@@ -398,21 +395,21 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     
     /** Sets the value of the 'parsedContent' field */
     public org.apache.gora.examples.generated.WebPage.Builder setParsedContent(java.util.List<java.lang.CharSequence> value) {
-      validate(fields()[3], value);
+      validate(fields()[2], value);
       this.parsedContent = value;
-      fieldSetFlags()[3] = true;
+      fieldSetFlags()[2] = true;
       return this; 
     }
     
     /** Checks whether the 'parsedContent' field has been set */
     public boolean hasParsedContent() {
-      return fieldSetFlags()[3];
+      return fieldSetFlags()[2];
     }
     
     /** Clears the value of the 'parsedContent' field */
     public org.apache.gora.examples.generated.WebPage.Builder clearParsedContent() {
       parsedContent = null;
-      fieldSetFlags()[3] = false;
+      fieldSetFlags()[2] = false;
       return this;
     }
     
@@ -423,21 +420,21 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     
     /** Sets the value of the 'outlinks' field */
     public org.apache.gora.examples.generated.WebPage.Builder setOutlinks(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
-      validate(fields()[4], value);
+      validate(fields()[3], value);
       this.outlinks = value;
-      fieldSetFlags()[4] = true;
+      fieldSetFlags()[3] = true;
       return this; 
     }
     
     /** Checks whether the 'outlinks' field has been set */
     public boolean hasOutlinks() {
-      return fieldSetFlags()[4];
+      return fieldSetFlags()[3];
     }
     
     /** Clears the value of the 'outlinks' field */
     public org.apache.gora.examples.generated.WebPage.Builder clearOutlinks() {
       outlinks = null;
-      fieldSetFlags()[4] = false;
+      fieldSetFlags()[3] = false;
       return this;
     }
     
@@ -448,21 +445,21 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     
     /** Sets the value of the 'headers' field */
     public org.apache.gora.examples.generated.WebPage.Builder setHeaders(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
-      validate(fields()[5], value);
+      validate(fields()[4], value);
       this.headers = value;
-      fieldSetFlags()[5] = true;
+      fieldSetFlags()[4] = true;
       return this; 
     }
     
     /** Checks whether the 'headers' field has been set */
     public boolean hasHeaders() {
-      return fieldSetFlags()[5];
+      return fieldSetFlags()[4];
     }
     
     /** Clears the value of the 'headers' field */
     public org.apache.gora.examples.generated.WebPage.Builder clearHeaders() {
       headers = null;
-      fieldSetFlags()[5] = false;
+      fieldSetFlags()[4] = false;
       return this;
     }
     
@@ -473,21 +470,21 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     
     /** Sets the value of the 'metadata' field */
     public org.apache.gora.examples.generated.WebPage.Builder setMetadata(org.apache.gora.examples.generated.Metadata value) {
-      validate(fields()[6], value);
+      validate(fields()[5], value);
       this.metadata = value;
-      fieldSetFlags()[6] = true;
+      fieldSetFlags()[5] = true;
       return this; 
     }
     
     /** Checks whether the 'metadata' field has been set */
     public boolean hasMetadata() {
-      return fieldSetFlags()[6];
+      return fieldSetFlags()[5];
     }
     
     /** Clears the value of the 'metadata' field */
     public org.apache.gora.examples.generated.WebPage.Builder clearMetadata() {
       metadata = null;
-      fieldSetFlags()[6] = false;
+      fieldSetFlags()[5] = false;
       return this;
     }
     
@@ -495,13 +492,12 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
     public WebPage build() {
       try {
         WebPage record = new WebPage();
-        record.__g__dirty = fieldSetFlags()[0] ? this.__g__dirty : (java.nio.ByteBuffer) java.nio.ByteBuffer.wrap(new byte[1]);
-        record.url = fieldSetFlags()[1] ? this.url : (java.lang.CharSequence) defaultValue(fields()[1]);
-        record.content = fieldSetFlags()[2] ? this.content : (java.nio.ByteBuffer) defaultValue(fields()[2]);
-        record.parsedContent = fieldSetFlags()[3] ? this.parsedContent : (java.util.List<java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)defaultValue(fields()[3]));
-        record.outlinks = fieldSetFlags()[4] ? this.outlinks : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[4]));
-        record.headers = fieldSetFlags()[5] ? this.headers : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) defaultValue(fields()[5]);
-        record.metadata = fieldSetFlags()[6] ? this.metadata : (org.apache.gora.examples.generated.Metadata) Metadata.newBuilder().build();
+        record.url = fieldSetFlags()[0] ? this.url : (java.lang.CharSequence) defaultValue(fields()[0]);
+        record.content = fieldSetFlags()[1] ? this.content : (java.nio.ByteBuffer) defaultValue(fields()[1]);
+        record.parsedContent = fieldSetFlags()[2] ? this.parsedContent : (java.util.List<java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyListWrapper((java.util.List)defaultValue(fields()[2]));
+        record.outlinks = fieldSetFlags()[3] ? this.outlinks : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) new org.apache.gora.persistency.impl.DirtyMapWrapper((java.util.Map)defaultValue(fields()[3]));
+        record.headers = fieldSetFlags()[4] ? this.headers : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) defaultValue(fields()[4]);
+        record.metadata = fieldSetFlags()[5] ? this.metadata : (org.apache.gora.examples.generated.Metadata) Metadata.newBuilder().build();
         return record;
       } catch (Exception e) {
         throw new org.apache.avro.AvroRuntimeException(e);
@@ -523,7 +519,7 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
   
       private Tombstone() { }
   
-	  				  /**
+	  		  /**
 	   * Gets the value of the 'url' field.
 		   */
 	  public java.lang.CharSequence getUrl() {
@@ -664,4 +660,5 @@ public class WebPage extends org.apache.gora.persistency.impl.PersistentBase imp
 		  
   }
   
-}
\ No newline at end of file
+}
+

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java b/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
index 99791dc..56c4816 100644
--- a/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
+++ b/gora-core/src/main/java/org/apache/gora/persistency/impl/PersistentBase.java
@@ -34,6 +34,15 @@ import org.apache.gora.persistency.Persistent;
 public abstract class PersistentBase extends SpecificRecordBase implements
     Persistent {
 
+  /** Bytes used to represent weather or not a field is dirty. */
+  private java.nio.ByteBuffer __g__dirty;
+
+  public PersistentBase() {
+    __g__dirty = java.nio.ByteBuffer.wrap(new byte[getFieldsCount()]);
+  }
+
+  public abstract int getFieldsCount();
+
   public static class PersistentData extends SpecificData {
     private static final PersistentData INSTANCE = new PersistentData();
 
@@ -173,7 +182,7 @@ public abstract class PersistentBase extends SpecificRecordBase implements
   }
 
   private ByteBuffer getDirtyBytes() {
-    return (ByteBuffer) get(0);
+    return __g__dirty;
   }
 
   @Override
@@ -200,7 +209,8 @@ public abstract class PersistentBase extends SpecificRecordBase implements
   
   public List<Field> getUnmanagedFields(){
     List<Field> fields = getSchema().getFields();
-    return fields.subList(1, fields.size());
+    //return fields.subList(1, fields.size());
+    return fields;
   }
   
 }

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/main/java/org/apache/gora/util/AvroUtils.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/util/AvroUtils.java b/gora-core/src/main/java/org/apache/gora/util/AvroUtils.java
index 1fd9a3d..3f51995 100644
--- a/gora-core/src/main/java/org/apache/gora/util/AvroUtils.java
+++ b/gora-core/src/main/java/org/apache/gora/util/AvroUtils.java
@@ -93,9 +93,9 @@ public class AvroUtils {
    */
   public static String[] getSchemaFieldNames(Schema schema) {
     List<Field> fields = schema.getFields();
-    String[] fieldNames = new String[fields.size() - 1];
+    String[] fieldNames = new String[fields.size()];
     for (int i = 0; i < fieldNames.length; i++) {
-      fieldNames[i] = fields.get(i + 1).name();
+      fieldNames[i] = fields.get(i).name();
     }
     return fieldNames;
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-core/src/test/java/org/apache/gora/mock/persistency/MockPersistent.java
----------------------------------------------------------------------
diff --git a/gora-core/src/test/java/org/apache/gora/mock/persistency/MockPersistent.java b/gora-core/src/test/java/org/apache/gora/mock/persistency/MockPersistent.java
index 93c5c11..1a83952 100644
--- a/gora-core/src/test/java/org/apache/gora/mock/persistency/MockPersistent.java
+++ b/gora-core/src/test/java/org/apache/gora/mock/persistency/MockPersistent.java
@@ -29,7 +29,14 @@ public class MockPersistent extends PersistentBase {
   public static final String BAZ = "baz";
   
   public static final String[] _ALL_FIELDS = {FOO, BAZ};
-  
+
+  /**
+   * Gets the total field count.
+   */
+  public int getFieldsCount() {
+    return MockPersistent._ALL_FIELDS.length;
+  }
+
   private int foo;
   private int baz;
   

http://git-wip-us.apache.org/repos/asf/gora/blob/60ce6487/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
index 92f0591..c5671b9 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseStore.java
@@ -239,7 +239,7 @@ implements Configurable {
       Put put = new Put(keyRaw);
       Delete delete = new Delete(keyRaw);
       List<Field> fields = schema.getFields();
-      for (int i = 1; i < fields.size(); i++) {
+      for (int i = 0; i < fields.size(); i++) {
         if (!persistent.isDirty(i)) {
           continue;
         }


Mime
View raw message