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
This commit is contained in:
Richard G. Curtis 2009-12-22 14:27:19 +00:00
parent ac6dab1d07
commit 35377aace9
2 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -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() {