From 35377aace92dfd5554b0e795e8178f93f1878d3a Mon Sep 17 00:00:00 2001 From: "Richard G. Curtis" Date: Tue, 22 Dec 2009 14:27:19 +0000 Subject: [PATCH] OPENJPA-1441: Set pcVersionInit FieldMetaData to transient in PCEnhancer. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@893181 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/openjpa/enhance/PCEnhancer.java | 1 + .../persistence/inheritance/serializable/Person.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java index 845be63ca..2a30d10ea 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCEnhancer.java @@ -3702,6 +3702,7 @@ public class PCEnhancer { if(fmd.isVersion()==true && _addVersionInitFlag){ // if we are setting the version, flip the versionInit flag to true FieldMetaData v = _meta.addDeclaredField(VERSION_INIT_STR, boolean.class); + v.setTransient(true); loadManagedInstance(code, true); code.constant().setValue(1); addSetManagedValueCode(code, v); diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/serializable/Person.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/serializable/Person.java index 513f3de6f..7865c4209 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/serializable/Person.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/serializable/Person.java @@ -24,6 +24,7 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; +import javax.persistence.Version; @Entity @Table(name="PERSON_SERIAL") @@ -37,6 +38,8 @@ public class Person implements Serializable { private String lastName; + private int version; + @Id @GeneratedValue public int getId() { @@ -62,6 +65,14 @@ public class Person implements Serializable { public void setLastName(String lastName) { this.lastName = lastName; } + + @Version + public int getVersion(){ + return version; + } + public void setVersion(int v){ + version = v; + } @Override public int hashCode() {