@Entity
public class Person {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
private int salary;
@Version
private long version;
// ...getters and setters
}
- may i know is there required to create set/get for "version" ?
- in my code ,when persist (saveorupdate) this entity with hibernate, i do not need to set any value for "version" right?
- why else do i need to configure in order to use optimistic concurrency checking with spring hibernateTemplate.saveorupdate? all database supported?
- how to unit-test this entity? in my database , all my records showing version field has value of 0
- is each time calling hibernatetemplate.saveorupdate, will increment the version value?