Package org.omnifaces.persistence.model
Class BaseEntity<I extends Comparable<I> & Serializable>
- java.lang.Object
-
- org.omnifaces.persistence.model.BaseEntity<I>
-
- Type Parameters:
I- The generic ID type.
- All Implemented Interfaces:
Serializable,Comparable<BaseEntity<I>>,Identifiable<I>
- Direct Known Subclasses:
GeneratedIdEntity,TimestampedBaseEntity
@MappedSuperclass public abstract class BaseEntity<I extends Comparable<I> & Serializable> extends Object implements Comparable<BaseEntity<I>>, Identifiable<I>, Serializable
Let all your entities extend from this. Then you can make use of
BaseEntityService.There are five more mapped superclasses which may also be of interest.
TimestampedBaseEntity- extendsBaseEntitywithcreatedandlastModifiedcolumns and automatically takes care of them.VersionedBaseEntity- extendsTimestampedBaseEntitywith a@Versioncolumn and automatically takes care of it.GeneratedIdEntity- extendsBaseEntitywithidcolumn and automatically takes care of it.TimestampedEntity- extendsGeneratedIdEntitywithcreatedandlastModifiedcolumns and automatically takes care of them.VersionedEntity- extendsTimestampedEntitywith a@Versioncolumn and automatically takes care of it.
- Author:
- Bauke Scholtz
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.omnifaces.persistence.model.Identifiable
ID
-
-
Constructor Summary
Constructors Constructor Description BaseEntity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(BaseEntity<I> other)Orders by default with "nulls last".booleanequals(Object other)Compares by default by entity class (proxies taken into account) and ID.inthashCode()Hashes by default the ID.StringtoString()The default format isClassName[{id}]where{id}defaults to@hashcodewhen null.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.omnifaces.persistence.model.Identifiable
getId, setId
-
-
-
-
Method Detail
-
equals
public boolean equals(Object other)
Compares by default by entity class (proxies taken into account) and ID.
-
compareTo
public int compareTo(BaseEntity<I> other)
Orders by default with "nulls last".- Specified by:
compareToin interfaceComparable<I extends Comparable<I> & Serializable>
-
-