Class AbstractPersistable<PK extends Serializable>
java.lang.Object
org.springframework.data.jpa.domain.AbstractPersistable<PK>
- Type Parameters:
PK
- the type of the identifier.
- All Implemented Interfaces:
Persistable<PK>
- Direct Known Subclasses:
AbstractAuditable
@MappedSuperclass
public abstract class AbstractPersistable<PK extends Serializable>
extends Object
implements Persistable<PK>
Abstract base class for entities. Allows parameterization of id type, chooses auto-generation and implements
equals(Object)
and hashCode()
based on that id.- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, Greg Turnquist
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
AbstractPersistable
public AbstractPersistable()
-
-
Method Details
-
getId
- Specified by:
getId
in interfacePersistable<PK extends Serializable>
-
setId
Sets the id of the entity.- Parameters:
id
- the id to set
-
isNew
public boolean isNew()Must beTransient
in order to ensure that no JPA provider complains because of a missing setter.- Specified by:
isNew
in interfacePersistable<PK extends Serializable>
- See Also:
-
toString
-
equals
-
hashCode
public int hashCode()
-