|
I am also facing the same issue. I am using 3.6.8-Final I have 2 entity objects
@Entity @Table(name="Customer") public class Customer { private Long id; private String name; private Gender gender;
@Id @Column(name="id") public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(name="name") public String getName() { return name; } public String setName(String name) { this.name = name; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="gender_id") public Gender getGender() { return gender; } public Gender setGender(Gender gender) { this.gender = gender; } } @Entity @Table(name="Gender") pubic class Gender{ private Long id; private String label; @Id @Column(name="id") public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
@Column(name="label") public String getLabel() { return label; }
public void setLabel(String label) { this.label = label; }
}
In my code I retrieve a Customer entity using a hql query. I set the name of the customer but don't change the gender. I have a preUpdateListener where I have a code something like the following public boolean preUpdate(PreUpdateEvent event) { int changedProperties[] = event.getPersister().findModified(event.getOldState(), event.getState(), event.getEntity(), event.getSession()); return false; }
. When I commit the transaction the preUpdateListener method shows me both name and gender fields as modified in the above preUpdateListener.
I verified that it happens for all ManyToOne fields and it is because of the issue mentioned in the original post.
Hope I could explain the issue.
|