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:
org.springframework.data.domain.Persistable<PK>
- Direct Known Subclasses:
AbstractAuditable
@MappedSuperclass
public abstract class AbstractPersistable<PK extends Serializable>
extends Object
implements org.springframework.data.domain.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 interfaceorg.springframework.data.domain.Persistable<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 interfaceorg.springframework.data.domain.Persistable<PK extends Serializable>
- See Also:
-
Persistable.isNew()
-
toString
-
equals
-
hashCode
public int hashCode()
-