Class AbstractGenericEto<ID>
- java.lang.Object
-
- com.devonfw.module.basic.common.api.to.AbstractTo
-
- com.devonfw.module.basic.common.api.to.AbstractGenericEto<ID>
-
- Type Parameters:
ID- type of theprimary key.
- All Implemented Interfaces:
GenericEntity<ID>,Serializable
- Direct Known Subclasses:
AbstractEto
public abstract class AbstractGenericEto<ID> extends AbstractTo implements GenericEntity<ID>
Typically you will deriveAbstractEtoinstead of this class. However, you can extend this class in case you need to have a primary key other thanLong(what is the recommended default in devon4j).
This is the abstract base class for antransfer-objectthat contains all the data properties of anentitywithout its relations. This is called ETO (entity transfer object). Sometimes in other contexts people also call this DTO (data transfer object).
Here, data properties are the properties using a datatype (immutable value type such asString,Number,Instant, custom-datatype, etc.). Relations of anentityare not contained except forIDsofOneToOnerelations. Instead of usingLongwe recommend to useIdRefto be type-safe and more expressive. For actual relations you will useCTOs to express what set of entities to transfer, load, save, update, etc. without redundancies.
Classes extending this class should carry the suffixEto.- Since:
- 2020.04.001
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractGenericEto.PersistentEntityAccessInner class to grant access to internal persistententityreference of anAbstractGenericEto.
-
Constructor Summary
Constructors Constructor Description AbstractGenericEto()The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetModificationCounter()This method gets the current modification-counter of this entity.voidsetModificationCounter(int version)-
Methods inherited from class com.devonfw.module.basic.common.api.to.AbstractTo
toString, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.devonfw.module.basic.common.api.entity.GenericEntity
getId, setId
-
-
-
-
Method Detail
-
getModificationCounter
public int getModificationCounter()
Description copied from interface:GenericEntityThis method gets the current modification-counter of this entity. Whenever the object gets modified andpersisted, this counter will be increased (typically after the transaction is closed). The initial value after construction is0.
This property is often simply calledversion. However, as this sometimes causes confusion or may conflict with a business property "version", we use the more technical and self-explanatory namemodificationCounter.
If this feature is NOT supported for some reason, this method should always return0.- Specified by:
getModificationCounterin interfaceGenericEntity<ID>- Returns:
- the current modification-counter.
- See Also:
Version,Version
-
setModificationCounter
public void setModificationCounter(int version)
- Specified by:
setModificationCounterin interfaceGenericEntity<ID>- Parameters:
version- the newmodification counter. This method shall typically only be used by technical frameworks such as hibernate.
-
-