public class Entity
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
Attempt to establish identity based on id if both exist.
|
java.lang.Long |
getId() |
java.lang.Integer |
getVersion() |
int |
hashCode()
Use ID if it exists to establish hash code, otherwise fall back to
Object.hashCode().
|
void |
incrementVersion()
Increment the version number
|
void |
setId(java.lang.Long id) |
void |
setVersion(java.lang.Integer version)
Public setter for the version needed only by repository methods.
|
java.lang.String |
toString() |
public java.lang.Long getId()
public void setId(java.lang.Long id)
public java.lang.Integer getVersion()
public void setVersion(java.lang.Integer version)
version
- the version to setpublic void incrementVersion()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
Entity
to a
Set because Set.contains() will almost certainly return false for the
Entity
after it is saved. Spring Batch does not store any of its
entities in Sets as a matter of course, so internally this is consistent.
Clients should not be exposed to unsaved entities.hashCode
in class java.lang.Object
Object.hashCode()