public abstract class BasicData extends Object implements IdentifiableData
getId()property and overrides the default implementations of the
For all practical purposes object identity is the same as database identity, ie.
two objects are considered equal if they reference the same row in the database.
Objects that has not yet been saved to the database should be handled carefully
and not be put into
Map:s since that may break
the contract for the
We recommend that the
not are overridden in subclasses, unless you really know what you are doing.
Actually, we would have liked to make the methods
final but that
would disable the proxy feature of Hibernate.
|Constructor and Description|
|Modifier and Type||Method and Description|
Check if this item is equal to another item.
Get the id of the item.
Get the version of the item.
For new items (getId() returns 0) the hash code is the same as returned by the
The string will look like
otherobject can be a Hibernate proxy, which is a dynamically generated subclass of the actual class. Do not override this method in a subclass!
public int hashCode()
System.identityHashCode()method. Items loaded from the database uses the
idas the hash code. We must also consider the case were a new object is saved to the database. Our recommendation is to not place the object in
Set(or other structure) that calls the
hashCodemethod before the object is saved to the database. If you do that the contract for the
equals()/hashCode()method is broken and
equals()may return true even if
hashCode()returns different values. Do not override this method in a subclass!
public int getId()
public int getVersion()