org.brains2b.data
Interface OptimisticLock

All Known Implementing Classes:
CursorData

public interface OptimisticLock

Interface that defines the methods used for optimistic locking.

Classes that use this interface should define a valid hashcode and a mutable member in which the hashcode can be set to a checksum.

Note:When calculating a hashcode for a dataobject that uses a ROWIDas primary key, be sure never to include the ROWID in het hascode calculation.

Version:
0.1 [31-03-2003]
Author:
dennis@brains2b.nl

Method Summary
 int getChecksum()
          get the checksum value
 int hashCode()
          get a hash for the particular object that implements this interface.
 void setChecksum(int value)
          set the checksum value.
 

Method Detail

getChecksum

public int getChecksum()
get the checksum value

Returns:
int, the checksum value

setChecksum

public void setChecksum(int value)
set the checksum value. Usually just a newly calculated hashCode()

Parameters:
value - int, the new checksum value

hashCode

public int hashCode()
get a hash for the particular object that implements this interface.

Here to remind you: You cannot rely on Object.hashCode() to implement a meaningfull OptimisticLock

Overrides:
hashCode in class java.lang.Object
Returns:
int
See Also:
Object.hashCode()