In order to use optimistic locking, hibernate recommends that you use an
integer version annotated with @Version on your entity.

@Entity
public class Person implements Serializable {
    @Column
    private String name;

    @Version
    @Column
    private Integer version;

    // getters and setters
}

Then you can submit the version as a hidden element on your form and
hibernate will throw an exception if the versions don't match.

<t:form>
  <t:textfield t:value="person.name" />
  <t:hidden t:value="person.value" />
  <t:submit />
</t:form>




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Tapestry-Hibernate-optimistic-locking-tp5718413p5718415.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to