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 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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue