Class AbstractGenericEto<ID>

  • Type Parameters:
    ID - type of the primary key.
    All Implemented Interfaces:
    GenericEntity<ID>, Serializable
    Direct Known Subclasses:
    AbstractEto

    public abstract class AbstractGenericEto<ID>
    extends AbstractTo
    implements GenericEntity<ID>
    Typically you will derive AbstractEto instead of this class. However, you can extend this class in case you need to have a primary key other than Long (what is the recommended default in devon4j).
    This is the abstract base class for an transfer-object that contains all the data properties of an entity without 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 as String, Number, Instant, custom-datatype, etc.). Relations of an entity are not contained except for IDs of OneToOne relations. Instead of using Long we recommend to use IdRef to be type-safe and more expressive. For actual relations you will use CTOs to express what set of entities to transfer, load, save, update, etc. without redundancies.
    Classes extending this class should carry the suffix Eto.
    Since:
    2020.04.001
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractGenericEto

        public AbstractGenericEto()
        The constructor.
    • Method Detail

      • getModificationCounter

        public int getModificationCounter()
        Description copied from interface: GenericEntity
        This method gets the current modification-counter of this entity. Whenever the object gets modified and persisted, this counter will be increased (typically after the transaction is closed). The initial value after construction is 0.
        This property is often simply called version. However, as this sometimes causes confusion or may conflict with a business property "version", we use the more technical and self-explanatory name modificationCounter.
        If this feature is NOT supported for some reason, this method should always return 0.
        Specified by:
        getModificationCounter in interface GenericEntity<ID>
        Returns:
        the current modification-counter.
        See Also:
        Version, Version