~opensource21/+junk/playmodules

« back to all changes in this revision

Viewing changes to optimisticlock/app/models/optimisticlock/VersionedModel.java

  • Committer: GrailsUser
  • Date: 2010-09-01 06:19:02 UTC
  • Revision ID: opensource21@googlemail.com-20100901061902-1j5te82dbwbn9egz
Changed to Long as Object because 0 is the start-value, so otherwise the optimistic lock will fail for the first change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
        private transient boolean optimisiticLockingViolated = false;
27
27
        
28
28
    @Version
29
 
    public long version;
 
29
    public Long version;
30
30
    
31
 
    public void setVersion(long newVersion) {
32
 
        if (version != 0 && newVersion != 0) {
33
 
                if (version > newVersion) {
 
31
    public void setVersion(Long newVersion) {
 
32
        if (version != null && newVersion != null) {
 
33
                if (version.longValue() > newVersion.longValue()) {
34
34
                        optimisiticLockingViolated = true;
35
35
                }
36
36
        }