gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [10/50] [abbrv] GORA-321. Merge GORA_94 into Gora trunk
Date Wed, 04 Jun 2014 16:36:27 GMT
http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/gora-core/src/examples/avro/tokendatum.json
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/avro/tokendatum.json b/gora-core/src/examples/avro/tokendatum.json
index 9dccb4b..2d8e4fe 100644
--- a/gora-core/src/examples/avro/tokendatum.json
+++ b/gora-core/src/examples/avro/tokendatum.json
@@ -3,6 +3,6 @@
   "name": "TokenDatum",
   "namespace": "org.apache.gora.examples.generated",
   "fields" : [
-    {"name": "count", "type": "int"}
+    {"name": "count", "type": "int","default":0}
   ]
 }

http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/gora-core/src/examples/avro/webpage.json
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/avro/webpage.json b/gora-core/src/examples/avro/webpage.json
index 946dfe1..f4e4aaf 100644
--- a/gora-core/src/examples/avro/webpage.json
+++ b/gora-core/src/examples/avro/webpage.json
@@ -1,20 +1,21 @@
 {
   "type": "record",
-  "name": "WebPage",
+  "name": "WebPage","default":null,
   "namespace": "org.apache.gora.examples.generated",
   "fields" : [
-    {"name": "url", "type": "string"},
-    {"name": "content", "type": ["null","bytes"]},
-    {"name": "parsedContent", "type": {"type":"array", "items": "string"}},
-    {"name": "outlinks", "type": {"type":"map", "values":"string"}},
-    {"name": "metadata", "type": {
+    {"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", "default":null, "type": {
       "name": "Metadata",
       "type": "record",
       "namespace": "org.apache.gora.examples.generated",
-      "fields": [
-        {"name": "version", "type": "int"},
-        {"name": "data", "type": {"type": "map", "values": "string"}}
+      "fields" : [
+        {"name":"version","type":"int","default":0},
+        {"name":"data","type":{"type":"map","values":"string"}, "default":null}
       ]
     }}
   ]
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java b/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
index cfbf31a..b41ef2d 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/WebPageDataCreator.java
@@ -20,17 +20,18 @@ package org.apache.gora.examples;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 
 import org.apache.avro.util.Utf8;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.gora.examples.generated.Metadata;
 import org.apache.gora.examples.generated.WebPage;
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Creates and stores some data to be used in the tests.
@@ -50,6 +51,7 @@ public class WebPageDataCreator {
     "http://baz.com/1.jsp&q=barbaz&p=foo",
     "http://baz.com/1.jsp&q=foo",
     "http://bazbar.com",
+    //"http://example.com",
   };
   
   public static HashMap<String, Integer> URL_INDEXES = new HashMap<String, Integer>();
@@ -71,6 +73,7 @@ public class WebPageDataCreator {
     "a b b b b b a",
     "a a a",
     "foo bar baz",
+    //"fck fck dck",
   };
   
   public static final int[][] LINKS = {
@@ -108,37 +111,38 @@ public class WebPageDataCreator {
   }
   
   public static void createWebPageData(DataStore<String, WebPage> dataStore) 
-  throws IOException {
-	  try{
-	    WebPage page;
-	    log.info("creating web page data");
-	    
-	    for(int i=0; i<URLS.length; i++) {
-	      page = new WebPage();
-	      page.setUrl(new Utf8(URLS[i]));
-	      if (CONTENTS[i]!=null){
-	        page.setContent(ByteBuffer.wrap(CONTENTS[i].getBytes()));
-	        for(String token : CONTENTS[i].split(" ")) {
-	    	  page.addToParsedContent(new Utf8(token));  
-	        }
+      throws IOException {
+    try{
+      WebPage page;
+      log.info("creating web page data");
+      
+      for(int i=0; i<URLS.length; i++) {
+        page = WebPage.newBuilder().build();
+        page.setUrl(new Utf8(URLS[i]));
+        page.setParsedContent(new ArrayList<CharSequence>());
+        if (CONTENTS[i]!=null){
+          page.setContent(ByteBuffer.wrap(CONTENTS[i].getBytes()));
+          for(String token : CONTENTS[i].split(" ")) {
+            page.getParsedContent().add(new Utf8(token));  
           }
-	      for(int j=0; j<LINKS[i].length; j++) {
-	        page.putToOutlinks(new Utf8(URLS[LINKS[i][j]]), new Utf8(ANCHORS[i][j]));
-	      }
-	      
-	      Metadata metadata = new Metadata();
-	      metadata.setVersion(1);
-	      metadata.putToData(new Utf8("metakey"), new Utf8("metavalue"));
-	      page.setMetadata(metadata);
-	      
-	      dataStore.put(URLS[i], page);
-	    }
-	    dataStore.flush();
-	    log.info("finished creating web page data");
-  	}
- 	catch(Exception e){
- 		log.info("error creating web page data");
- 	}
+        }
+        for(int j=0; j<LINKS[i].length; j++) {
+          page.getOutlinks().put(new Utf8(URLS[LINKS[i][j]]), new Utf8(ANCHORS[i][j]));
+        }
+        
+        Metadata metadata = Metadata.newBuilder().build();
+        metadata.setVersion(1);
+        metadata.getData().put(new Utf8("metakey"), new Utf8("metavalue"));
+        page.setMetadata(metadata);
+
+        dataStore.put(URLS[i], page);
+      }
+      dataStore.flush();
+      log.info("finished creating web page data");
+    }
+    catch(Exception e){
+      log.info("error creating web page data");
+    } 
   }
   
   public int run(String[] args) throws Exception {

http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/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 f956527..1dd4b76 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
@@ -1,281 +1,664 @@
 /**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the"
- *License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
-  * http://www.apache.org/licenses/LICENSE-2.0
+ * Autogenerated by Avro
  * 
- *Unless required by applicable law or agreed to in writing, software
- *distributed under the License is distributed on an "AS IS" BASIS,
- *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *See the License for the specific language governing permissions and
- *limitations under the License.
+ * DO NOT EDIT DIRECTLY
  */
-
-package org.apache.gora.examples.generated;
-
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.avro.Protocol;
-import org.apache.avro.Schema;
-import org.apache.avro.AvroRuntimeException;
-import org.apache.avro.Protocol;
-import org.apache.avro.util.Utf8;
-import org.apache.avro.ipc.AvroRemoteException;
-import org.apache.avro.generic.GenericArray;
-import org.apache.avro.specific.FixedSize;
-import org.apache.avro.specific.SpecificExceptionBase;
-import org.apache.avro.specific.SpecificRecordBase;
-import org.apache.avro.specific.SpecificRecord;
-import org.apache.avro.specific.SpecificFixed;
-import org.apache.gora.persistency.StateManager;
-import org.apache.gora.persistency.impl.PersistentBase;
-import org.apache.gora.persistency.impl.StateManagerImpl;
-import org.apache.gora.persistency.StatefulHashMap;
-import org.apache.gora.persistency.ListGenericArray;
+package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
-public class Employee extends PersistentBase {
-  
-  /**
-   * Variable holding the data bean schema.
-   */
-  public static final Schema _SCHEMA = Schema.parse("{\"type\":\"record\",\"name\":\"Employee\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"dateOfBirth\",\"type\":\"long\"},{\"name\":\"ssn\",\"type\":\"string\"},{\"name\":\"salary\",\"type\":\"int\"},{\"name\":\"boss\",\"type\":[\"null\",\"Employee\",\"string\"]},{\"name\":\"webpage\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"WebPage\",\"fields\":[{\"name\":\"url\",\"type\":\"string\"},{\"name\":\"content\",\"type\":[\"null\",\"bytes\"]},{\"name\":\"parsedContent\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"outlinks\",\"type\":{\"type\":\"map\",\"values\":\"string\"}},{\"name\":\"metadata\",\"type\":{\"type\":\"record\",\"name\":\"Metadata\",\"fields\":[{\"name\":\"version\",\"type\":\"int\"},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"}}]}}]}]}]}");
-  
-  /**
-   * Enum containing all data bean's fields.
-   */
+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}]}");
+
+  /** Enum containing all data bean's fields. */
   public static enum Field {
-    NAME(0,"name"),
-    DATE_OF_BIRTH(1,"dateOfBirth"),
-    SSN(2,"ssn"),
-    SALARY(3,"salary"),
-    BOSS(4,"boss"),
-    WEBPAGE(5,"webpage"),
+    __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"),
     ;
-    
     /**
      * Field's index.
      */
     private int index;
-    
+
     /**
      * Field's name.
      */
     private String name;
-    
+
     /**
      * Field's constructor
      * @param index field's index.
      * @param name field's name.
      */
     Field(int index, String name) {this.index=index;this.name=name;}
-    
+
     /**
      * Gets field's index.
      * @return int field's index.
      */
     public int getIndex() {return index;}
-    
+
     /**
      * Gets field's name.
      * @return String field's name.
      */
     public String getName() {return name;}
-    
+
     /**
      * Gets field's attributes to string.
      * @return String field's attributes to string.
      */
     public String toString() {return name;}
   };
-    
-    /**
-     * Contains all field's names.
-     */
-  public static final String[] _ALL_FIELDS = {"name","dateOfBirth","ssn","salary","boss","webpage",};
-  static {
-    PersistentBase.registerFields(Employee.class, _ALL_FIELDS);
-  }
-  private Utf8 name;
+
+  public static final String[] _ALL_FIELDS = {
+  "__g__dirty",
+  "name",
+  "dateOfBirth",
+  "ssn",
+  "salary",
+  "boss",
+  "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]);
+  private java.lang.CharSequence name;
   private long dateOfBirth;
-  private Utf8 ssn;
+  private java.lang.CharSequence ssn;
   private int salary;
-  private Object boss;
-  private WebPage webpage;
+  private java.lang.Object boss;
+  private org.apache.gora.examples.generated.WebPage webpage;
+  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 name;
+    case 2: return dateOfBirth;
+    case 3: return ssn;
+    case 4: return salary;
+    case 5: return boss;
+    case 6: return webpage;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
   
+  // Used by DatumReader.  Applications should not call. 
+  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;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
+
   /**
-   * Default Constructor
+   * Gets the value of the 'name' field.
    */
-  public Employee() {
-    this(new StateManagerImpl());
+  public java.lang.CharSequence getName() {
+    return name;
   }
-  
+
   /**
-   * Constructor
-   * @param stateManager for the data bean.
+   * Sets the value of the 'name' field.
+   * @param value the value to set.
    */
-  public Employee(StateManager stateManager) {
-    super(stateManager);
+  public void setName(java.lang.CharSequence value) {
+    this.name = value;
+    setDirty(1);
   }
   
   /**
-   * Returns a new instance by using a state manager.
-   * @param stateManager for the data bean.
-   * @return Employee created.
+   * Checks the dirty status of the 'name' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  public Employee newInstance(StateManager stateManager) {
-    return new Employee(stateManager);
+  public boolean isNameDirty(java.lang.CharSequence value) {
+    return isDirty(1);
   }
-  
+
   /**
-   * Returns the schema of the data bean.
-   * @return Schema for the data bean.
+   * Gets the value of the 'dateOfBirth' field.
    */
-  public Schema getSchema() { return _SCHEMA; }
-  
+  public java.lang.Long getDateOfBirth() {
+    return dateOfBirth;
+  }
+
   /**
-   * Gets a specific field.
-   * @param field index of a field for the data bean.
-   * @return Object representing a data bean's field.
+   * Sets the value of the 'dateOfBirth' field.
+   * @param value the value to set.
    */
-  public Object get(int _field) {
-    switch (_field) {
-    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 AvroRuntimeException("Bad index");
-    }
+  public void setDateOfBirth(java.lang.Long value) {
+    this.dateOfBirth = value;
+    setDirty(2);
   }
   
   /**
-   * Puts a value for a specific field.
-   * @param field index of a field for the data bean.
-   * @param value value of a field for the data bean.
+   * Checks the dirty status of the 'dateOfBirth' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  @SuppressWarnings(value="unchecked")
-  public void put(int _field, Object _value) {
-    if(isFieldEqual(_field, _value)) return;
-    getStateManager().setDirty(this, _field);
-    switch (_field) {
-    case 0:name = (Utf8)_value; break;
-    case 1:dateOfBirth = (Long)_value; break;
-    case 2:ssn = (Utf8)_value; break;
-    case 3:salary = (Integer)_value; break;
-    case 4:boss = (Object)_value; break;
-    case 5:webpage = (WebPage)_value; break;
-    default: throw new AvroRuntimeException("Bad index");
-    }
+  public boolean isDateOfBirthDirty(java.lang.Long value) {
+    return isDirty(2);
   }
-  
+
   /**
-   * Gets the Name.
-   * @return Utf8 representing Employee Name.
+   * Gets the value of the 'ssn' field.
    */
-  public Utf8 getName() {
-    return (Utf8) get(0);
+  public java.lang.CharSequence getSsn() {
+    return ssn;
   }
-  
+
   /**
-   * Sets the Name.
-   * @param value containing Employee Name.
+   * Sets the value of the 'ssn' field.
+   * @param value the value to set.
    */
-  public void setName(Utf8 value) {
-    put(0, value);
+  public void setSsn(java.lang.CharSequence value) {
+    this.ssn = value;
+    setDirty(3);
   }
   
   /**
-   * Gets the DateOfBirth.
-   * @return long representing Employee DateOfBirth.
+   * Checks the dirty status of the 'ssn' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  public long getDateOfBirth() {
-    return (Long) get(1);
+  public boolean isSsnDirty(java.lang.CharSequence value) {
+    return isDirty(3);
   }
-  
+
   /**
-   * Sets the DateOfBirth.
-   * @param value containing Employee DateOfBirth.
+   * Gets the value of the 'salary' field.
    */
-  public void setDateOfBirth(long value) {
-    put(1, value);
+  public java.lang.Integer getSalary() {
+    return salary;
   }
-  
+
   /**
-   * Gets the Ssn.
-   * @return Utf8 representing Employee Ssn.
+   * Sets the value of the 'salary' field.
+   * @param value the value to set.
    */
-  public Utf8 getSsn() {
-    return (Utf8) get(2);
+  public void setSalary(java.lang.Integer value) {
+    this.salary = value;
+    setDirty(4);
   }
   
   /**
-   * Sets the Ssn.
-   * @param value containing Employee Ssn.
+   * Checks the dirty status of the 'salary' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  public void setSsn(Utf8 value) {
-    put(2, value);
+  public boolean isSalaryDirty(java.lang.Integer value) {
+    return isDirty(4);
   }
-  
+
   /**
-   * Gets the Salary.
-   * @return int representing Employee Salary.
+   * Gets the value of the 'boss' field.
    */
-  public int getSalary() {
-    return (Integer) get(3);
+  public java.lang.Object getBoss() {
+    return boss;
   }
-  
+
   /**
-   * Sets the Salary.
-   * @param value containing Employee Salary.
+   * Sets the value of the 'boss' field.
+   * @param value the value to set.
    */
-  public void setSalary(int value) {
-    put(3, value);
+  public void setBoss(java.lang.Object value) {
+    this.boss = value;
+    setDirty(5);
   }
   
   /**
-   * Gets Boss.
-   * @return the Object value.
+   * Checks the dirty status of the 'boss' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  public Object getBoss() {
-    return (Object) get(4);
+  public boolean isBossDirty(java.lang.Object value) {
+    return isDirty(5);
   }
-  
+
   /**
-   * Sets the Boss.
-   * @param the Boss value to be set.
+   * Gets the value of the 'webpage' field.
    */
-  public void setBoss(Employee value) {
-    put(4, value);
+  public org.apache.gora.examples.generated.WebPage getWebpage() {
+    return webpage;
   }
-  
+
   /**
-   * Sets the Boss.
-   * @param the Boss value to be set.
+   * Sets the value of the 'webpage' field.
+   * @param value the value to set.
    */
-  public void setBoss(Utf8 value) {
-    put(4, value);
+  public void setWebpage(org.apache.gora.examples.generated.WebPage value) {
+    this.webpage = value;
+    setDirty(6);
   }
   
   /**
-   * Gets Webpage.
-   * @return the WebPage value.
+   * Checks the dirty status of the 'webpage' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  public WebPage getWebpage() {
-    return (WebPage) get(5);
+  public boolean isWebpageDirty(org.apache.gora.examples.generated.WebPage value) {
+    return isDirty(6);
+  }
+
+  /** Creates a new Employee RecordBuilder */
+  public static org.apache.gora.examples.generated.Employee.Builder newBuilder() {
+    return new org.apache.gora.examples.generated.Employee.Builder();
+  }
+  
+  /** Creates a new Employee RecordBuilder by copying an existing Builder */
+  public static org.apache.gora.examples.generated.Employee.Builder newBuilder(org.apache.gora.examples.generated.Employee.Builder other) {
+    return new org.apache.gora.examples.generated.Employee.Builder(other);
+  }
+  
+  /** Creates a new Employee RecordBuilder by copying an existing Employee instance */
+  public static org.apache.gora.examples.generated.Employee.Builder newBuilder(org.apache.gora.examples.generated.Employee other) {
+    return new org.apache.gora.examples.generated.Employee.Builder(other);
+  }
+  
+  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+      java.nio.ByteBuffer input) {
+    java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
+    int position = input.position();
+    input.reset();
+    int mark = input.position();
+    int limit = input.limit();
+    input.rewind();
+    input.limit(input.capacity());
+    copy.put(input);
+    input.rewind();
+    copy.rewind();
+    input.position(mark);
+    input.mark();
+    copy.position(mark);
+    copy.mark();
+    input.position(position);
+    copy.position(position);
+    input.limit(limit);
+    copy.limit(limit);
+    return copy.asReadOnlyBuffer();
   }
   
   /**
-   * Sets the Webpage.
-   * @param the Webpage value to be set.
+   * RecordBuilder for Employee instances.
    */
-  public void setWebpage(WebPage value) {
-    put(5, value);
+  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;
+    private int salary;
+    private java.lang.Object boss;
+    private org.apache.gora.examples.generated.WebPage webpage;
+
+    /** Creates a new Builder */
+    private Builder() {
+      super(org.apache.gora.examples.generated.Employee.SCHEMA$);
+    }
+    
+    /** Creates a Builder by copying an existing Builder */
+    private Builder(org.apache.gora.examples.generated.Employee.Builder other) {
+      super(other);
+    }
+    
+    /** 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);
+        fieldSetFlags()[0] = true;
+      }
+      if (isValidValue(fields()[1], other.name)) {
+        this.name = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.name);
+        fieldSetFlags()[1] = true;
+      }
+      if (isValidValue(fields()[2], other.dateOfBirth)) {
+        this.dateOfBirth = (java.lang.Long) data().deepCopy(fields()[2].schema(), other.dateOfBirth);
+        fieldSetFlags()[2] = true;
+      }
+      if (isValidValue(fields()[3], other.ssn)) {
+        this.ssn = (java.lang.CharSequence) data().deepCopy(fields()[3].schema(), other.ssn);
+        fieldSetFlags()[3] = true;
+      }
+      if (isValidValue(fields()[4], other.salary)) {
+        this.salary = (java.lang.Integer) data().deepCopy(fields()[4].schema(), other.salary);
+        fieldSetFlags()[4] = true;
+      }
+      if (isValidValue(fields()[5], other.boss)) {
+        this.boss = (java.lang.Object) data().deepCopy(fields()[5].schema(), other.boss);
+        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 */
+    public java.lang.CharSequence getName() {
+      return name;
+    }
+    
+    /** Sets the value of the 'name' field */
+    public org.apache.gora.examples.generated.Employee.Builder setName(java.lang.CharSequence value) {
+      validate(fields()[1], value);
+      this.name = value;
+      fieldSetFlags()[1] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'name' field has been set */
+    public boolean hasName() {
+      return fieldSetFlags()[1];
+    }
+    
+    /** Clears the value of the 'name' field */
+    public org.apache.gora.examples.generated.Employee.Builder clearName() {
+      name = null;
+      fieldSetFlags()[1] = false;
+      return this;
+    }
+    
+    /** Gets the value of the 'dateOfBirth' field */
+    public java.lang.Long getDateOfBirth() {
+      return dateOfBirth;
+    }
+    
+    /** Sets the value of the 'dateOfBirth' field */
+    public org.apache.gora.examples.generated.Employee.Builder setDateOfBirth(long value) {
+      validate(fields()[2], value);
+      this.dateOfBirth = value;
+      fieldSetFlags()[2] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'dateOfBirth' field has been set */
+    public boolean hasDateOfBirth() {
+      return fieldSetFlags()[2];
+    }
+    
+    /** Clears the value of the 'dateOfBirth' field */
+    public org.apache.gora.examples.generated.Employee.Builder clearDateOfBirth() {
+      fieldSetFlags()[2] = false;
+      return this;
+    }
+    
+    /** Gets the value of the 'ssn' field */
+    public java.lang.CharSequence getSsn() {
+      return ssn;
+    }
+    
+    /** Sets the value of the 'ssn' field */
+    public org.apache.gora.examples.generated.Employee.Builder setSsn(java.lang.CharSequence value) {
+      validate(fields()[3], value);
+      this.ssn = value;
+      fieldSetFlags()[3] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'ssn' field has been set */
+    public boolean hasSsn() {
+      return fieldSetFlags()[3];
+    }
+    
+    /** Clears the value of the 'ssn' field */
+    public org.apache.gora.examples.generated.Employee.Builder clearSsn() {
+      ssn = null;
+      fieldSetFlags()[3] = false;
+      return this;
+    }
+    
+    /** Gets the value of the 'salary' field */
+    public java.lang.Integer getSalary() {
+      return salary;
+    }
+    
+    /** Sets the value of the 'salary' field */
+    public org.apache.gora.examples.generated.Employee.Builder setSalary(int value) {
+      validate(fields()[4], value);
+      this.salary = value;
+      fieldSetFlags()[4] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'salary' field has been set */
+    public boolean hasSalary() {
+      return fieldSetFlags()[4];
+    }
+    
+    /** Clears the value of the 'salary' field */
+    public org.apache.gora.examples.generated.Employee.Builder clearSalary() {
+      fieldSetFlags()[4] = false;
+      return this;
+    }
+    
+    /** Gets the value of the 'boss' field */
+    public java.lang.Object getBoss() {
+      return boss;
+    }
+    
+    /** Sets the value of the 'boss' field */
+    public org.apache.gora.examples.generated.Employee.Builder setBoss(java.lang.Object value) {
+      validate(fields()[5], value);
+      this.boss = value;
+      fieldSetFlags()[5] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'boss' field has been set */
+    public boolean hasBoss() {
+      return fieldSetFlags()[5];
+    }
+    
+    /** Clears the value of the 'boss' field */
+    public org.apache.gora.examples.generated.Employee.Builder clearBoss() {
+      boss = null;
+      fieldSetFlags()[5] = false;
+      return this;
+    }
+    
+    /** Gets the value of the 'webpage' field */
+    public org.apache.gora.examples.generated.WebPage getWebpage() {
+      return webpage;
+    }
+    
+    /** 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);
+      this.webpage = value;
+      fieldSetFlags()[6] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'webpage' field has been set */
+    public boolean hasWebpage() {
+      return fieldSetFlags()[6];
+    }
+    
+    /** Clears the value of the 'webpage' field */
+    public org.apache.gora.examples.generated.Employee.Builder clearWebpage() {
+      webpage = null;
+      fieldSetFlags()[6] = false;
+      return this;
+    }
+    
+    @Override
+    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]);
+        return record;
+      } catch (Exception e) {
+        throw new org.apache.avro.AvroRuntimeException(e);
+      }
+    }
+  }
+  
+  public Employee.Tombstone getTombstone(){
+  	return TOMBSTONE;
   }
-}
+
+  public Employee newInstance(){
+    return newBuilder().build();
+  }
+
+  private static final Tombstone TOMBSTONE = new Tombstone();
+  
+  public static final class Tombstone extends Employee implements org.apache.gora.persistency.Tombstone {
+  
+      private Tombstone() { }
+  
+	  				  /**
+	   * Gets the value of the 'name' field.
+		   */
+	  public java.lang.CharSequence getName() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'name' field.
+		   * @param value the value to set.
+	   */
+	  public void setName(java.lang.CharSequence value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'name' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isNameDirty(java.lang.CharSequence value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+				  /**
+	   * Gets the value of the 'dateOfBirth' field.
+		   */
+	  public java.lang.Long getDateOfBirth() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'dateOfBirth' field.
+		   * @param value the value to set.
+	   */
+	  public void setDateOfBirth(java.lang.Long value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'dateOfBirth' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isDateOfBirthDirty(java.lang.Long value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+				  /**
+	   * Gets the value of the 'ssn' field.
+		   */
+	  public java.lang.CharSequence getSsn() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'ssn' field.
+		   * @param value the value to set.
+	   */
+	  public void setSsn(java.lang.CharSequence value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'ssn' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isSsnDirty(java.lang.CharSequence value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+				  /**
+	   * Gets the value of the 'salary' field.
+		   */
+	  public java.lang.Integer getSalary() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'salary' field.
+		   * @param value the value to set.
+	   */
+	  public void setSalary(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'salary' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isSalaryDirty(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+				  /**
+	   * Gets the value of the 'boss' field.
+		   */
+	  public java.lang.Object getBoss() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'boss' field.
+		   * @param value the value to set.
+	   */
+	  public void setBoss(java.lang.Object value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'boss' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isBossDirty(java.lang.Object value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+				  /**
+	   * Gets the value of the 'webpage' field.
+		   */
+	  public org.apache.gora.examples.generated.WebPage getWebpage() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'webpage' field.
+		   * @param value the value to set.
+	   */
+	  public void setWebpage(org.apache.gora.examples.generated.WebPage value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'webpage' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isWebpageDirty(org.apache.gora.examples.generated.WebPage value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+		  
+  }
+  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/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
new file mode 100644
index 0000000..c36a4c0
--- /dev/null
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/ImmutableFields.java
@@ -0,0 +1,335 @@
+/**
+ * Autogenerated by Avro
+ * 
+ * DO NOT EDIT DIRECTLY
+ */
+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}]}");
+
+  /** Enum containing all data bean's fields. */
+  public static enum Field {
+    __G__DIRTY(0, "__g__dirty"),
+    V1(1, "v1"),
+    V2(2, "v2"),
+    ;
+    /**
+     * Field's index.
+     */
+    private int index;
+
+    /**
+     * Field's name.
+     */
+    private String name;
+
+    /**
+     * Field's constructor
+     * @param index field's index.
+     * @param name field's name.
+     */
+    Field(int index, String name) {this.index=index;this.name=name;}
+
+    /**
+     * Gets field's index.
+     * @return int field's index.
+     */
+    public int getIndex() {return index;}
+
+    /**
+     * Gets field's name.
+     * @return String field's name.
+     */
+    public String getName() {return name;}
+
+    /**
+     * Gets field's attributes to string.
+     * @return String field's attributes to string.
+     */
+    public String toString() {return name;}
+  };
+
+  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]);
+  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;
+    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: v1 = (java.lang.Integer)(value); break;
+    case 2: v2 = (org.apache.gora.examples.generated.V2)(value); break;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
+
+  /**
+   * Gets the value of the 'v1' field.
+   */
+  public java.lang.Integer getV1() {
+    return v1;
+  }
+
+  /**
+   * Sets the value of the 'v1' field.
+   * @param value the value to set.
+   */
+  public void setV1(java.lang.Integer value) {
+    this.v1 = value;
+    setDirty(1);
+  }
+  
+  /**
+   * Checks the dirty status of the 'v1' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
+   */
+  public boolean isV1Dirty(java.lang.Integer value) {
+    return isDirty(1);
+  }
+
+  /**
+   * Gets the value of the 'v2' field.
+   */
+  public org.apache.gora.examples.generated.V2 getV2() {
+    return v2;
+  }
+
+  /**
+   * Sets the value of the 'v2' field.
+   * @param value the value to set.
+   */
+  public void setV2(org.apache.gora.examples.generated.V2 value) {
+    this.v2 = value;
+    setDirty(2);
+  }
+  
+  /**
+   * Checks the dirty status of the 'v2' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
+   */
+  public boolean isV2Dirty(org.apache.gora.examples.generated.V2 value) {
+    return isDirty(2);
+  }
+
+  /** Creates a new ImmutableFields RecordBuilder */
+  public static org.apache.gora.examples.generated.ImmutableFields.Builder newBuilder() {
+    return new org.apache.gora.examples.generated.ImmutableFields.Builder();
+  }
+  
+  /** Creates a new ImmutableFields RecordBuilder by copying an existing Builder */
+  public static org.apache.gora.examples.generated.ImmutableFields.Builder newBuilder(org.apache.gora.examples.generated.ImmutableFields.Builder other) {
+    return new org.apache.gora.examples.generated.ImmutableFields.Builder(other);
+  }
+  
+  /** Creates a new ImmutableFields RecordBuilder by copying an existing ImmutableFields instance */
+  public static org.apache.gora.examples.generated.ImmutableFields.Builder newBuilder(org.apache.gora.examples.generated.ImmutableFields other) {
+    return new org.apache.gora.examples.generated.ImmutableFields.Builder(other);
+  }
+  
+  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+      java.nio.ByteBuffer input) {
+    java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
+    int position = input.position();
+    input.reset();
+    int mark = input.position();
+    int limit = input.limit();
+    input.rewind();
+    input.limit(input.capacity());
+    copy.put(input);
+    input.rewind();
+    copy.rewind();
+    input.position(mark);
+    input.mark();
+    copy.position(mark);
+    copy.mark();
+    input.position(position);
+    copy.position(position);
+    input.limit(limit);
+    copy.limit(limit);
+    return copy.asReadOnlyBuffer();
+  }
+  
+  /**
+   * RecordBuilder for ImmutableFields instances.
+   */
+  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;
+
+    /** Creates a new Builder */
+    private Builder() {
+      super(org.apache.gora.examples.generated.ImmutableFields.SCHEMA$);
+    }
+    
+    /** Creates a Builder by copying an existing Builder */
+    private Builder(org.apache.gora.examples.generated.ImmutableFields.Builder other) {
+      super(other);
+    }
+    
+    /** 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);
+        fieldSetFlags()[0] = true;
+      }
+      if (isValidValue(fields()[1], other.v1)) {
+        this.v1 = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.v1);
+        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 */
+    public java.lang.Integer getV1() {
+      return v1;
+    }
+    
+    /** Sets the value of the 'v1' field */
+    public org.apache.gora.examples.generated.ImmutableFields.Builder setV1(int value) {
+      validate(fields()[1], value);
+      this.v1 = value;
+      fieldSetFlags()[1] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'v1' field has been set */
+    public boolean hasV1() {
+      return fieldSetFlags()[1];
+    }
+    
+    /** Clears the value of the 'v1' field */
+    public org.apache.gora.examples.generated.ImmutableFields.Builder clearV1() {
+      fieldSetFlags()[1] = false;
+      return this;
+    }
+    
+    /** Gets the value of the 'v2' field */
+    public org.apache.gora.examples.generated.V2 getV2() {
+      return v2;
+    }
+    
+    /** 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);
+      this.v2 = value;
+      fieldSetFlags()[2] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'v2' field has been set */
+    public boolean hasV2() {
+      return fieldSetFlags()[2];
+    }
+    
+    /** Clears the value of the 'v2' field */
+    public org.apache.gora.examples.generated.ImmutableFields.Builder clearV2() {
+      v2 = null;
+      fieldSetFlags()[2] = false;
+      return this;
+    }
+    
+    @Override
+    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]);
+        return record;
+      } catch (Exception e) {
+        throw new org.apache.avro.AvroRuntimeException(e);
+      }
+    }
+  }
+  
+  public ImmutableFields.Tombstone getTombstone(){
+  	return TOMBSTONE;
+  }
+
+  public ImmutableFields newInstance(){
+    return newBuilder().build();
+  }
+
+  private static final Tombstone TOMBSTONE = new Tombstone();
+  
+  public static final class Tombstone extends ImmutableFields implements org.apache.gora.persistency.Tombstone {
+  
+      private Tombstone() { }
+  
+	  				  /**
+	   * Gets the value of the 'v1' field.
+		   */
+	  public java.lang.Integer getV1() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'v1' field.
+		   * @param value the value to set.
+	   */
+	  public void setV1(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'v1' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isV1Dirty(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+				  /**
+	   * Gets the value of the 'v2' field.
+		   */
+	  public org.apache.gora.examples.generated.V2 getV2() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'v2' field.
+		   * @param value the value to set.
+	   */
+	  public void setV2(org.apache.gora.examples.generated.V2 value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'v2' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isV2Dirty(org.apache.gora.examples.generated.V2 value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+		  
+  }
+  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/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 80fda77..8de390f 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
@@ -1,215 +1,334 @@
 /**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the"
- *License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
-  * http://www.apache.org/licenses/LICENSE-2.0
+ * Autogenerated by Avro
  * 
- *Unless required by applicable law or agreed to in writing, software
- *distributed under the License is distributed on an "AS IS" BASIS,
- *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *See the License for the specific language governing permissions and
- *limitations under the License.
+ * DO NOT EDIT DIRECTLY
  */
-
-package org.apache.gora.examples.generated;
-
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.avro.Protocol;
-import org.apache.avro.Schema;
-import org.apache.avro.AvroRuntimeException;
-import org.apache.avro.Protocol;
-import org.apache.avro.util.Utf8;
-import org.apache.avro.ipc.AvroRemoteException;
-import org.apache.avro.generic.GenericArray;
-import org.apache.avro.specific.FixedSize;
-import org.apache.avro.specific.SpecificExceptionBase;
-import org.apache.avro.specific.SpecificRecordBase;
-import org.apache.avro.specific.SpecificRecord;
-import org.apache.avro.specific.SpecificFixed;
-import org.apache.gora.persistency.StateManager;
-import org.apache.gora.persistency.impl.PersistentBase;
-import org.apache.gora.persistency.impl.StateManagerImpl;
-import org.apache.gora.persistency.StatefulHashMap;
-import org.apache.gora.persistency.ListGenericArray;
+package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
-public class Metadata extends PersistentBase {
-  
-  /**
-   * Variable holding the data bean schema.
-   */
-  public static final Schema _SCHEMA = Schema.parse("{\"type\":\"record\",\"name\":\"Metadata\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"version\",\"type\":\"int\"},{\"name\":\"data\",\"type\":{\"type\":\"map\",\"values\":\"string\"}}]}");
-  
-  /**
-   * Enum containing all data bean's fields.
-   */
+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\":{}}]}");
+
+  /** Enum containing all data bean's fields. */
   public static enum Field {
-    VERSION(0,"version"),
-    DATA(1,"data"),
+    __G__DIRTY(0, "__g__dirty"),
+    VERSION(1, "version"),
+    DATA(2, "data"),
     ;
-    
     /**
      * Field's index.
      */
     private int index;
-    
+
     /**
      * Field's name.
      */
     private String name;
-    
+
     /**
      * Field's constructor
      * @param index field's index.
      * @param name field's name.
      */
     Field(int index, String name) {this.index=index;this.name=name;}
-    
+
     /**
      * Gets field's index.
      * @return int field's index.
      */
     public int getIndex() {return index;}
-    
+
     /**
      * Gets field's name.
      * @return String field's name.
      */
     public String getName() {return name;}
-    
+
     /**
      * Gets field's attributes to string.
      * @return String field's attributes to string.
      */
     public String toString() {return name;}
   };
-    
-    /**
-     * Contains all field's names.
-     */
-  public static final String[] _ALL_FIELDS = {"version","data",};
-  static {
-    PersistentBase.registerFields(Metadata.class, _ALL_FIELDS);
-  }
+
+  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]);
   private int version;
-  private Map<Utf8,Utf8> data;
+  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;
+    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: 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;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
+
   /**
-   * Default Constructor
+   * Gets the value of the 'version' field.
    */
-  public Metadata() {
-    this(new StateManagerImpl());
+  public java.lang.Integer getVersion() {
+    return version;
   }
-  
+
   /**
-   * Constructor
-   * @param stateManager for the data bean.
+   * Sets the value of the 'version' field.
+   * @param value the value to set.
    */
-  public Metadata(StateManager stateManager) {
-    super(stateManager);
-    data = new StatefulHashMap<Utf8,Utf8>();
+  public void setVersion(java.lang.Integer value) {
+    this.version = value;
+    setDirty(1);
   }
   
   /**
-   * Returns a new instance by using a state manager.
-   * @param stateManager for the data bean.
-   * @return Metadata created.
+   * Checks the dirty status of the 'version' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  public Metadata newInstance(StateManager stateManager) {
-    return new Metadata(stateManager);
+  public boolean isVersionDirty(java.lang.Integer value) {
+    return isDirty(1);
   }
-  
+
   /**
-   * Returns the schema of the data bean.
-   * @return Schema for the data bean.
+   * Gets the value of the 'data' field.
    */
-  public Schema getSchema() { return _SCHEMA; }
-  
+  public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getData() {
+    return data;
+  }
+
   /**
-   * Gets a specific field.
-   * @param field index of a field for the data bean.
-   * @return Object representing a data bean's field.
+   * Sets the value of the 'data' field.
+   * @param value the value to set.
    */
-  public Object get(int _field) {
-    switch (_field) {
-    case 0: return version;
-    case 1: return data;
-    default: throw new AvroRuntimeException("Bad index");
-    }
+  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);
   }
   
   /**
-   * Puts a value for a specific field.
-   * @param field index of a field for the data bean.
-   * @param value value of a field for the data bean.
+   * Checks the dirty status of the 'data' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  @SuppressWarnings(value="unchecked")
-  public void put(int _field, Object _value) {
-    if(isFieldEqual(_field, _value)) return;
-    getStateManager().setDirty(this, _field);
-    switch (_field) {
-    case 0:version = (Integer)_value; break;
-    case 1:data = (Map<Utf8,Utf8>)_value; break;
-    default: throw new AvroRuntimeException("Bad index");
-    }
+  public boolean isDataDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
+    return isDirty(2);
+  }
+
+  /** Creates a new Metadata RecordBuilder */
+  public static org.apache.gora.examples.generated.Metadata.Builder newBuilder() {
+    return new org.apache.gora.examples.generated.Metadata.Builder();
   }
   
-  /**
-   * Gets the Version.
-   * @return int representing Metadata Version.
-   */
-  public int getVersion() {
-    return (Integer) get(0);
+  /** Creates a new Metadata RecordBuilder by copying an existing Builder */
+  public static org.apache.gora.examples.generated.Metadata.Builder newBuilder(org.apache.gora.examples.generated.Metadata.Builder other) {
+    return new org.apache.gora.examples.generated.Metadata.Builder(other);
   }
   
-  /**
-   * Sets the Version.
-   * @param value containing Metadata Version.
-   */
-  public void setVersion(int value) {
-    put(0, value);
+  /** Creates a new Metadata RecordBuilder by copying an existing Metadata instance */
+  public static org.apache.gora.examples.generated.Metadata.Builder newBuilder(org.apache.gora.examples.generated.Metadata other) {
+    return new org.apache.gora.examples.generated.Metadata.Builder(other);
   }
   
-  /**
-   * Gets Data.
-   * @return Map containing Data value.
-   */
-  public Map<Utf8, Utf8> getData() {
-    return (Map<Utf8, Utf8>) get(1);
+  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+      java.nio.ByteBuffer input) {
+    java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
+    int position = input.position();
+    input.reset();
+    int mark = input.position();
+    int limit = input.limit();
+    input.rewind();
+    input.limit(input.capacity());
+    copy.put(input);
+    input.rewind();
+    copy.rewind();
+    input.position(mark);
+    input.mark();
+    copy.position(mark);
+    copy.mark();
+    input.position(position);
+    copy.position(position);
+    input.limit(limit);
+    copy.limit(limit);
+    return copy.asReadOnlyBuffer();
   }
   
   /**
-   * Gets the Data's value using a key.
-   * @param key gets a specific Data using a MetadataID.
-   * @return Utf8 containing Data value.
+   * RecordBuilder for Metadata instances.
    */
-  public Utf8 getFromData(Utf8 key) {
-    if (data == null) { return null; }
-    return data.get(key);
+  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;
+
+    /** Creates a new Builder */
+    private Builder() {
+      super(org.apache.gora.examples.generated.Metadata.SCHEMA$);
+    }
+    
+    /** Creates a Builder by copying an existing Builder */
+    private Builder(org.apache.gora.examples.generated.Metadata.Builder other) {
+      super(other);
+    }
+    
+    /** 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);
+        fieldSetFlags()[0] = true;
+      }
+      if (isValidValue(fields()[1], other.version)) {
+        this.version = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.version);
+        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 */
+    public java.lang.Integer getVersion() {
+      return version;
+    }
+    
+    /** Sets the value of the 'version' field */
+    public org.apache.gora.examples.generated.Metadata.Builder setVersion(int value) {
+      validate(fields()[1], value);
+      this.version = value;
+      fieldSetFlags()[1] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'version' field has been set */
+    public boolean hasVersion() {
+      return fieldSetFlags()[1];
+    }
+    
+    /** Clears the value of the 'version' field */
+    public org.apache.gora.examples.generated.Metadata.Builder clearVersion() {
+      fieldSetFlags()[1] = false;
+      return this;
+    }
+    
+    /** Gets the value of the 'data' field */
+    public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getData() {
+      return data;
+    }
+    
+    /** 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);
+      this.data = value;
+      fieldSetFlags()[2] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'data' field has been set */
+    public boolean hasData() {
+      return fieldSetFlags()[2];
+    }
+    
+    /** Clears the value of the 'data' field */
+    public org.apache.gora.examples.generated.Metadata.Builder clearData() {
+      data = null;
+      fieldSetFlags()[2] = false;
+      return this;
+    }
+    
+    @Override
+    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]));
+        return record;
+      } catch (Exception e) {
+        throw new org.apache.avro.AvroRuntimeException(e);
+      }
+    }
   }
   
-  /**
-   * Adds a Data into a Metadata.
-   * @param Map containing Data value.
-   */
-  public void putToData(Utf8 key, Utf8 value) {
-    getStateManager().setDirty(this, 1);
-    data.put(key, value);
+  public Metadata.Tombstone getTombstone(){
+  	return TOMBSTONE;
   }
+
+  public Metadata newInstance(){
+    return newBuilder().build();
+  }
+
+  private static final Tombstone TOMBSTONE = new Tombstone();
   
-  /**
-   * Removes Data from a Metadata.
-   * @return key Metadata ID to be removed.
-   */
-  public Utf8 removeFromData(Utf8 key) {
-    if (data == null) { return null; }
-    getStateManager().setDirty(this, 1);
-    return data.remove(key);
+  public static final class Tombstone extends Metadata implements org.apache.gora.persistency.Tombstone {
+  
+      private Tombstone() { }
+  
+	  				  /**
+	   * Gets the value of the 'version' field.
+		   */
+	  public java.lang.Integer getVersion() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'version' field.
+		   * @param value the value to set.
+	   */
+	  public void setVersion(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'version' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isVersionDirty(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+				  /**
+	   * Gets the value of the 'data' field.
+		   */
+	  public java.util.Map<java.lang.CharSequence,java.lang.CharSequence> getData() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'data' field.
+		   * @param value the value to set.
+	   */
+	  public void setData(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'data' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isDataDirty(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+		  
   }
-}
+  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/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 a79dfc6..70d8b3f 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
@@ -1,173 +1,251 @@
 /**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the"
- *License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
-  * http://www.apache.org/licenses/LICENSE-2.0
+ * Autogenerated by Avro
  * 
- *Unless required by applicable law or agreed to in writing, software
- *distributed under the License is distributed on an "AS IS" BASIS,
- *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *See the License for the specific language governing permissions and
- *limitations under the License.
+ * DO NOT EDIT DIRECTLY
  */
-
-package org.apache.gora.examples.generated;
-
-import java.nio.ByteBuffer;
-import java.util.Map;
-import java.util.HashMap;
-import org.apache.avro.Protocol;
-import org.apache.avro.Schema;
-import org.apache.avro.AvroRuntimeException;
-import org.apache.avro.Protocol;
-import org.apache.avro.util.Utf8;
-import org.apache.avro.ipc.AvroRemoteException;
-import org.apache.avro.generic.GenericArray;
-import org.apache.avro.specific.FixedSize;
-import org.apache.avro.specific.SpecificExceptionBase;
-import org.apache.avro.specific.SpecificRecordBase;
-import org.apache.avro.specific.SpecificRecord;
-import org.apache.avro.specific.SpecificFixed;
-import org.apache.gora.persistency.StateManager;
-import org.apache.gora.persistency.impl.PersistentBase;
-import org.apache.gora.persistency.impl.StateManagerImpl;
-import org.apache.gora.persistency.StatefulHashMap;
-import org.apache.gora.persistency.ListGenericArray;
+package org.apache.gora.examples.generated;  
 @SuppressWarnings("all")
-public class TokenDatum extends PersistentBase {
-  
-  /**
-   * Variable holding the data bean schema.
-   */
-  public static final Schema _SCHEMA = Schema.parse("{\"type\":\"record\",\"name\":\"TokenDatum\",\"namespace\":\"org.apache.gora.examples.generated\",\"fields\":[{\"name\":\"count\",\"type\":\"int\"}]}");
-  
-  /**
-   * Enum containing all data bean's fields.
-   */
+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}]}");
+
+  /** Enum containing all data bean's fields. */
   public static enum Field {
-    COUNT(0,"count"),
+    __G__DIRTY(0, "__g__dirty"),
+    COUNT(1, "count"),
     ;
-    
     /**
      * Field's index.
      */
     private int index;
-    
+
     /**
      * Field's name.
      */
     private String name;
-    
+
     /**
      * Field's constructor
      * @param index field's index.
      * @param name field's name.
      */
     Field(int index, String name) {this.index=index;this.name=name;}
-    
+
     /**
      * Gets field's index.
      * @return int field's index.
      */
     public int getIndex() {return index;}
-    
+
     /**
      * Gets field's name.
      * @return String field's name.
      */
     public String getName() {return name;}
-    
+
     /**
      * Gets field's attributes to string.
      * @return String field's attributes to string.
      */
     public String toString() {return name;}
   };
-    
-    /**
-     * Contains all field's names.
-     */
-  public static final String[] _ALL_FIELDS = {"count",};
-  static {
-    PersistentBase.registerFields(TokenDatum.class, _ALL_FIELDS);
-  }
+
+  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]);
   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;
+    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: count = (java.lang.Integer)(value); break;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
+
   /**
-   * Default Constructor
+   * Gets the value of the 'count' field.
    */
-  public TokenDatum() {
-    this(new StateManagerImpl());
+  public java.lang.Integer getCount() {
+    return count;
   }
-  
+
   /**
-   * Constructor
-   * @param stateManager for the data bean.
+   * Sets the value of the 'count' field.
+   * @param value the value to set.
    */
-  public TokenDatum(StateManager stateManager) {
-    super(stateManager);
+  public void setCount(java.lang.Integer value) {
+    this.count = value;
+    setDirty(1);
   }
   
   /**
-   * Returns a new instance by using a state manager.
-   * @param stateManager for the data bean.
-   * @return TokenDatum created.
+   * Checks the dirty status of the 'count' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
    */
-  public TokenDatum newInstance(StateManager stateManager) {
-    return new TokenDatum(stateManager);
+  public boolean isCountDirty(java.lang.Integer value) {
+    return isDirty(1);
+  }
+
+  /** Creates a new TokenDatum RecordBuilder */
+  public static org.apache.gora.examples.generated.TokenDatum.Builder newBuilder() {
+    return new org.apache.gora.examples.generated.TokenDatum.Builder();
   }
   
-  /**
-   * Returns the schema of the data bean.
-   * @return Schema for the data bean.
-   */
-  public Schema getSchema() { return _SCHEMA; }
+  /** Creates a new TokenDatum RecordBuilder by copying an existing Builder */
+  public static org.apache.gora.examples.generated.TokenDatum.Builder newBuilder(org.apache.gora.examples.generated.TokenDatum.Builder other) {
+    return new org.apache.gora.examples.generated.TokenDatum.Builder(other);
+  }
   
-  /**
-   * Gets a specific field.
-   * @param field index of a field for the data bean.
-   * @return Object representing a data bean's field.
-   */
-  public Object get(int _field) {
-    switch (_field) {
-    case 0: return count;
-    default: throw new AvroRuntimeException("Bad index");
-    }
+  /** Creates a new TokenDatum RecordBuilder by copying an existing TokenDatum instance */
+  public static org.apache.gora.examples.generated.TokenDatum.Builder newBuilder(org.apache.gora.examples.generated.TokenDatum other) {
+    return new org.apache.gora.examples.generated.TokenDatum.Builder(other);
+  }
+  
+  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+      java.nio.ByteBuffer input) {
+    java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
+    int position = input.position();
+    input.reset();
+    int mark = input.position();
+    int limit = input.limit();
+    input.rewind();
+    input.limit(input.capacity());
+    copy.put(input);
+    input.rewind();
+    copy.rewind();
+    input.position(mark);
+    input.mark();
+    copy.position(mark);
+    copy.mark();
+    input.position(position);
+    copy.position(position);
+    input.limit(limit);
+    copy.limit(limit);
+    return copy.asReadOnlyBuffer();
   }
   
   /**
-   * Puts a value for a specific field.
-   * @param field index of a field for the data bean.
-   * @param value value of a field for the data bean.
+   * RecordBuilder for TokenDatum instances.
    */
-  @SuppressWarnings(value="unchecked")
-  public void put(int _field, Object _value) {
-    if(isFieldEqual(_field, _value)) return;
-    getStateManager().setDirty(this, _field);
-    switch (_field) {
-    case 0:count = (Integer)_value; break;
-    default: throw new AvroRuntimeException("Bad index");
+  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 */
+    private Builder() {
+      super(org.apache.gora.examples.generated.TokenDatum.SCHEMA$);
+    }
+    
+    /** Creates a Builder by copying an existing Builder */
+    private Builder(org.apache.gora.examples.generated.TokenDatum.Builder other) {
+      super(other);
+    }
+    
+    /** 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);
+        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 */
+    public java.lang.Integer getCount() {
+      return count;
+    }
+    
+    /** Sets the value of the 'count' field */
+    public org.apache.gora.examples.generated.TokenDatum.Builder setCount(int value) {
+      validate(fields()[1], value);
+      this.count = value;
+      fieldSetFlags()[1] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'count' field has been set */
+    public boolean hasCount() {
+      return fieldSetFlags()[1];
+    }
+    
+    /** Clears the value of the 'count' field */
+    public org.apache.gora.examples.generated.TokenDatum.Builder clearCount() {
+      fieldSetFlags()[1] = false;
+      return this;
+    }
+    
+    @Override
+    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]);
+        return record;
+      } catch (Exception e) {
+        throw new org.apache.avro.AvroRuntimeException(e);
+      }
     }
   }
   
-  /**
-   * Gets the Count.
-   * @return int representing TokenDatum Count.
-   */
-  public int getCount() {
-    return (Integer) get(0);
+  public TokenDatum.Tombstone getTombstone(){
+  	return TOMBSTONE;
   }
+
+  public TokenDatum newInstance(){
+    return newBuilder().build();
+  }
+
+  private static final Tombstone TOMBSTONE = new Tombstone();
   
-  /**
-   * Sets the Count.
-   * @param value containing TokenDatum Count.
-   */
-  public void setCount(int value) {
-    put(0, value);
+  public static final class Tombstone extends TokenDatum implements org.apache.gora.persistency.Tombstone {
+  
+      private Tombstone() { }
+  
+	  				  /**
+	   * Gets the value of the 'count' field.
+		   */
+	  public java.lang.Integer getCount() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'count' field.
+		   * @param value the value to set.
+	   */
+	  public void setCount(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'count' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isCountDirty(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+		  
   }
-}
+  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/gora/blob/136fc595/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
new file mode 100644
index 0000000..9cccc1a
--- /dev/null
+++ b/gora-core/src/examples/java/org/apache/gora/examples/generated/V2.java
@@ -0,0 +1,251 @@
+/**
+ * Autogenerated by Avro
+ * 
+ * DO NOT EDIT DIRECTLY
+ */
+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}]}");
+
+  /** Enum containing all data bean's fields. */
+  public static enum Field {
+    __G__DIRTY(0, "__g__dirty"),
+    V3(1, "v3"),
+    ;
+    /**
+     * Field's index.
+     */
+    private int index;
+
+    /**
+     * Field's name.
+     */
+    private String name;
+
+    /**
+     * Field's constructor
+     * @param index field's index.
+     * @param name field's name.
+     */
+    Field(int index, String name) {this.index=index;this.name=name;}
+
+    /**
+     * Gets field's index.
+     * @return int field's index.
+     */
+    public int getIndex() {return index;}
+
+    /**
+     * Gets field's name.
+     * @return String field's name.
+     */
+    public String getName() {return name;}
+
+    /**
+     * Gets field's attributes to string.
+     * @return String field's attributes to string.
+     */
+    public String toString() {return name;}
+  };
+
+  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]);
+  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;
+    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: v3 = (java.lang.Integer)(value); break;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
+
+  /**
+   * Gets the value of the 'v3' field.
+   */
+  public java.lang.Integer getV3() {
+    return v3;
+  }
+
+  /**
+   * Sets the value of the 'v3' field.
+   * @param value the value to set.
+   */
+  public void setV3(java.lang.Integer value) {
+    this.v3 = value;
+    setDirty(1);
+  }
+  
+  /**
+   * Checks the dirty status of the 'v3' field. A field is dirty if it represents a change that has not yet been written to the database.
+   * @param value the value to set.
+   */
+  public boolean isV3Dirty(java.lang.Integer value) {
+    return isDirty(1);
+  }
+
+  /** Creates a new V2 RecordBuilder */
+  public static org.apache.gora.examples.generated.V2.Builder newBuilder() {
+    return new org.apache.gora.examples.generated.V2.Builder();
+  }
+  
+  /** Creates a new V2 RecordBuilder by copying an existing Builder */
+  public static org.apache.gora.examples.generated.V2.Builder newBuilder(org.apache.gora.examples.generated.V2.Builder other) {
+    return new org.apache.gora.examples.generated.V2.Builder(other);
+  }
+  
+  /** Creates a new V2 RecordBuilder by copying an existing V2 instance */
+  public static org.apache.gora.examples.generated.V2.Builder newBuilder(org.apache.gora.examples.generated.V2 other) {
+    return new org.apache.gora.examples.generated.V2.Builder(other);
+  }
+  
+  private static java.nio.ByteBuffer deepCopyToWriteOnlyBuffer(
+      java.nio.ByteBuffer input) {
+    java.nio.ByteBuffer copy = java.nio.ByteBuffer.allocate(input.capacity());
+    int position = input.position();
+    input.reset();
+    int mark = input.position();
+    int limit = input.limit();
+    input.rewind();
+    input.limit(input.capacity());
+    copy.put(input);
+    input.rewind();
+    copy.rewind();
+    input.position(mark);
+    input.mark();
+    copy.position(mark);
+    copy.mark();
+    input.position(position);
+    copy.position(position);
+    input.limit(limit);
+    copy.limit(limit);
+    return copy.asReadOnlyBuffer();
+  }
+  
+  /**
+   * RecordBuilder for V2 instances.
+   */
+  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 */
+    private Builder() {
+      super(org.apache.gora.examples.generated.V2.SCHEMA$);
+    }
+    
+    /** Creates a Builder by copying an existing Builder */
+    private Builder(org.apache.gora.examples.generated.V2.Builder other) {
+      super(other);
+    }
+    
+    /** 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);
+        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 */
+    public java.lang.Integer getV3() {
+      return v3;
+    }
+    
+    /** Sets the value of the 'v3' field */
+    public org.apache.gora.examples.generated.V2.Builder setV3(int value) {
+      validate(fields()[1], value);
+      this.v3 = value;
+      fieldSetFlags()[1] = true;
+      return this; 
+    }
+    
+    /** Checks whether the 'v3' field has been set */
+    public boolean hasV3() {
+      return fieldSetFlags()[1];
+    }
+    
+    /** Clears the value of the 'v3' field */
+    public org.apache.gora.examples.generated.V2.Builder clearV3() {
+      fieldSetFlags()[1] = false;
+      return this;
+    }
+    
+    @Override
+    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]);
+        return record;
+      } catch (Exception e) {
+        throw new org.apache.avro.AvroRuntimeException(e);
+      }
+    }
+  }
+  
+  public V2.Tombstone getTombstone(){
+  	return TOMBSTONE;
+  }
+
+  public V2 newInstance(){
+    return newBuilder().build();
+  }
+
+  private static final Tombstone TOMBSTONE = new Tombstone();
+  
+  public static final class Tombstone extends V2 implements org.apache.gora.persistency.Tombstone {
+  
+      private Tombstone() { }
+  
+	  				  /**
+	   * Gets the value of the 'v3' field.
+		   */
+	  public java.lang.Integer getV3() {
+	    throw new java.lang.UnsupportedOperationException("Get is not supported on tombstones");
+	  }
+	
+	  /**
+	   * Sets the value of the 'v3' field.
+		   * @param value the value to set.
+	   */
+	  public void setV3(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("Set is not supported on tombstones");
+	  }
+	  
+	  /**
+	   * Checks the dirty status of the 'v3' field. A field is dirty if it represents a change that has not yet been written to the database.
+		   * @param value the value to set.
+	   */
+	  public boolean isV3Dirty(java.lang.Integer value) {
+	    throw new java.lang.UnsupportedOperationException("IsDirty is not supported on tombstones");
+	  }
+	
+		  
+  }
+  
+}
\ No newline at end of file


Mime
View raw message