mirror of https://github.com/apache/openjpa.git
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:
parent
ac6dab1d07
commit
35377aace9
|
@ -3702,6 +3702,7 @@ public class PCEnhancer {
|
||||||
if(fmd.isVersion()==true && _addVersionInitFlag){
|
if(fmd.isVersion()==true && _addVersionInitFlag){
|
||||||
// if we are setting the version, flip the versionInit flag to true
|
// if we are setting the version, flip the versionInit flag to true
|
||||||
FieldMetaData v = _meta.addDeclaredField(VERSION_INIT_STR, boolean.class);
|
FieldMetaData v = _meta.addDeclaredField(VERSION_INIT_STR, boolean.class);
|
||||||
|
v.setTransient(true);
|
||||||
loadManagedInstance(code, true);
|
loadManagedInstance(code, true);
|
||||||
code.constant().setValue(1);
|
code.constant().setValue(1);
|
||||||
addSetManagedValueCode(code, v);
|
addSetManagedValueCode(code, v);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Version;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="PERSON_SERIAL")
|
@Table(name="PERSON_SERIAL")
|
||||||
|
@ -37,6 +38,8 @@ public class Person implements Serializable {
|
||||||
|
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
|
private int version;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -63,6 +66,14 @@ public class Person implements Serializable {
|
||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Version
|
||||||
|
public int getVersion(){
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
public void setVersion(int v){
|
||||||
|
version = v;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
|
Loading…
Reference in New Issue