Annotation Type Entity


  • @Retention(SOURCE)
    @Target(TYPE)
    public @interface Entity
    Annotation for entities greenDAO only persist objects of classes which are marked with this annotation
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      boolean active
      Whether update/delete/refresh methods should be generated.
      boolean createInDb
      Advanced flag to disable table creation in the database (when set to false).
      boolean generateConstructors
      Whether an all properties constructor should be generated.
      boolean generateGettersSetters
      Whether getters and setters for properties should be generated if missing.
      Index[] indexes
      Indexes for the entity.
      java.lang.String nameInDb
      Specifies the name on the DB side (e.g.
      java.lang.Class protobuf
      Define a protobuf class of this entity to create an additional, special DAO for.
      java.lang.String schema
      Specifies schema name for the entity: greenDAO can generate independent sets of classes for each schema.
    • Element Detail

      • nameInDb

        java.lang.String nameInDb
        Specifies the name on the DB side (e.g. table name) this entity maps to. By default, the name is based on the entities class name.
        Default:
        ""
      • indexes

        Index[] indexes
        Indexes for the entity.

        Note: To create a single-column index consider using Index on the property itself

        Default:
        {}
      • createInDb

        boolean createInDb
        Advanced flag to disable table creation in the database (when set to false). This can be used to create partial entities, which may use only a sub set of properties. Be aware however that greenDAO does not sync multiple entities, e.g. in caches.
        Default:
        true
      • schema

        java.lang.String schema
        Specifies schema name for the entity: greenDAO can generate independent sets of classes for each schema. Entities which belong to different schemas should not have relations.
        Default:
        "default"
      • active

        boolean active
        Whether update/delete/refresh methods should be generated. If entity has defined ToMany or ToOne relations, then it is active independently from this value
        Default:
        false
      • generateConstructors

        boolean generateConstructors
        Whether an all properties constructor should be generated. A no-args constructor is always required.
        Default:
        true
      • generateGettersSetters

        boolean generateGettersSetters
        Whether getters and setters for properties should be generated if missing.
        Default:
        true
      • protobuf

        java.lang.Class protobuf
        Define a protobuf class of this entity to create an additional, special DAO for.
        Default:
        void.class