Class AbstractEntity

  • All Implemented Interfaces:
    Serializable, EntityInterface

    @MappedSuperclass
    public class AbstractEntity
    extends Object
    implements 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:
    Serialized Form
    • Constructor Detail

      • AbstractEntity

        public AbstractEntity()
    • Method Detail

      • setId

        public void setId​(Integer id)
      • getVersion

        public int getVersion()
      • setVersion

        public void setVersion​(int version)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isTransient

        public boolean isTransient()
        is the entity in the db?
        Specified by:
        isTransient in interface EntityInterface
        Returns:
        true when version < 0 (version default value is -1) or id is null