I have something like Person
, and Address
object(Person
has an Address
and other properties).
I update Address
or other properties in one request. And in another request I'm searching through all persons. But sometimes I can see properties modified and sometimes I cannot.
Just making another request will return me either modified or unmodified properties.
Where's the mistake. I tried to flush everywhere, commit, but without any success. Any idea?
My mapping:
@Entity
@Table(schema="zet",name="phone_number")
public class PhoneNumber {
private String id;
private String number;
private Person person;
private int status;
......
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public void setPerson(Person person) {
this.person = person;
}
@OneToOne(cascade= { CascadeType.PERSIST, CascadeType.MERGE,
CascadeType.REFRESH })
@JoinColumn(name="person_id")
public Person getPerson() {
return person;
}
public void setNumber(String number) {
this.number = number;
}
@Column(name="num",unique=true,nullable=false)
public String getNumber() {
return number;
}
public void setId(String id) {
this.id = id;
}
@Id
@Column(name = "id", nullable = false)
public String getId() {
return id;
}
}