Hi,
i've go a little problem with the @Versions annotation of hibernate(3.5.6 Final and jpa 2.0).
In my program there is a customer with version, who has got an address with a version.
If some value of the customer changes e.g. name the version of the customer is increased - good, but the version of the unchanged address is changed too - bad cause the attribute did not change.
How can this happen? Is it possible to fix this behaviour?
Thanks for any reply.
Code:
@Entity
@Table(name = CUSTOMER")
@Inheritance(strategy = InheritanceType.JOINED)
public class Customer
{
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "CUST_BILLING_ADDRESS_ID")
@ForeignKey(name = "FK_CUSTOMER_BILLING_ADDRESS")
@Valid
private Address billingAddress;
@Version
@Column(name = "CUST_VERSION", nullable = true)
private long version = 0;
...
}
@Entity
@Table(name = "ADDRESS")
public class Address
{
@Version
@Column(name = "ADDRESS_VERSION", nullable = true)
private long version = 0;
...
}