Package org.fryske_akademy.jpa
Class AbstractEntity
java.lang.Object
org.fryske_akademy.jpa.AbstractEntity
- All Implemented Interfaces:
Serializable,EntityInterface
superclass for entities, defines auto generated id (
GenerationType.IDENTITY), a version column and a function to check if the entity is transient (not in db yet).
Jpa annotations are on getters which allows you to override. If you want to annotate fields in your subclasses be sure to annotate with
AccessType.FIELD.- Author:
- eduard
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetId()an entity should have an idintinthashCode()booleanis the entity in the db?voidvoidsetVersion(int version)
-
Constructor Details
-
AbstractEntity
public AbstractEntity()
-
-
Method Details
-
getId
Description copied from interface:EntityInterfacean entity should have an id- Specified by:
getIdin interfaceEntityInterface- Returns:
-
setId
-
getVersion
public int getVersion() -
setVersion
public void setVersion(int version) -
hashCode
public int hashCode() -
equals
-
isTransient
public boolean isTransient()is the entity in the db?- Specified by:
isTransientin interfaceEntityInterface- Returns:
- true when version < 0 (version default value is -1) or id is null
-