Interface Entity

  • All Known Subinterfaces:
    EntityBean
    All Known Implementing Classes:
    SimpleEntityBean

    public interface Entity
    This is the interface for an entity that can be loaded from or saved to a database. It can be identified uniquely by its primary key. Typically you may want to use EntityBean but for legacy technologies such as JPA you have to use standard Java Beans.
    Since:
    1.0.0
    • Method Detail

      • getId

        Id<? extends Entity> getId()
        Returns:
        the unique ID (primary key) of this entity or null if not available (e.g. entity is not persistent).
      • setId

        void setId​(Id<? extends Entity> id)
        Parameters:
        id - the new ID.
      • getId

        static <B extends EntityId<B> getId​(B bean)
        Type Parameters:
        B - type of Entity.
        Parameters:
        bean - the Entity instance. May be null.
        Returns:
        the Id of the given Entity. May be null if given Entity was null or its Id is null.