Spring Data Jpa

org.springframework.data.jpa.domain
Class AbstractPersistable<PK extends Serializable>

java.lang.Object
  extended by org.springframework.data.jpa.domain.AbstractPersistable<PK>
Type Parameters:
PK - the the of the entity
All Implemented Interfaces:
Serializable, 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
See Also:
Serialized Form

Constructor Summary
AbstractPersistable()
           
 
Method Summary
 boolean equals(Object obj)
           
 PK getId()
           
 int hashCode()
           
 boolean isNew()
           
protected  void setId(PK id)
          Sets the id of the entity.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPersistable

public AbstractPersistable()
Method Detail

getId

public PK getId()
Specified by:
getId in interface Persistable<PK extends Serializable>

setId

protected void setId(PK id)
Sets the id of the entity.

Parameters:
id - the id to set

isNew

public boolean isNew()
Specified by:
isNew in interface Persistable<PK extends Serializable>

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Spring Data Jpa

Copyright © 2011 SpringSource. All Rights Reserved.