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
- extendsBaseEntity
withcreated
andlastModified
columns and automatically takes care of them.VersionedBaseEntity
- extendsTimestampedBaseEntity
with a@Version
column and automatically takes care of it.GeneratedIdEntity
- extendsBaseEntity
withid
column and automatically takes care of it.TimestampedEntity
- extendsGeneratedIdEntity
withcreated
andlastModified
columns and automatically takes care of them.VersionedEntity
- extendsTimestampedEntity
with a@Version
column 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 int
compareTo(BaseEntity<I> other)
Orders by default with "nulls last".boolean
equals(Object other)
Compares by default by entity class (proxies taken into account) and ID.int
hashCode()
Hashes by default the ID.String
toString()
The default format isClassName[{id}]
where{id}
defaults to@hashcode
when 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:
compareTo
in interfaceComparable<I extends Comparable<I> & Serializable>
-
-