- Type Parameters:
K - Type of the primary key.
- All Implemented Interfaces:
- Serializable, Entity<K>
- Direct Known Subclasses:
- AbstractGeneratedIdEntity, AbstractIdEntity, GeneratedLongIdEntity, LongIdEntity
@MappedSuperclass
public abstract class AbstractEntity<K>
extends Object
implements Entity<K>
Represents an entity with a primary key. The method getId() must be implemented, even if the primary key has a
different field name, also make sure that the primary key implements equals/hashcode correctly. hashCode() and
equals() are based on the id, so make sure not to use id in any context where these methods are important while no id
is set (e.g. in HashMaps) or you must override them.
- Author:
- Philip W. Sorst
- See Also:
- Serialized Form