annotations/entity_annotations library

Classes

Column
This annotation is used for when you want to change default name of column name of a field in table. You have to know that the default column name is property name.
Embedded
If you want to use an object that you have defined yourself, in your entity, you can use this annotation. Suppose that the Note entity has an address property that is an object itself. In this situation, you can use this annotation on that field. Embedded objects also can have embedded fields. Embedded object fields, can have Column and Ignore annotation, but they can't have PrimaryKey. You should note that the fields of embedded object, merge with entity fields in table. For example, for the below entity, created table has these columns: id, text, address_lat and address_lng. If you have noticed, embedded object fields has a prefix in its column name that is field name by default. You can change this prefix by change prefix property of Embedded annotation.
Entity
Annotation for create table in database. You can set tableName and indices for this table, in this annotation. If you don't set tableName, the class name will be set as the default name. You have to set primary key for table using PrimaryKey annotation. The entity must have exactly one primary key and only integer primary key can be auto increment. All properties of the class that this annotation applied on, map to a column in the table unless properties that Ignore annotation are applied on. Default column name is property name. If you want to change it use Column annotation and set name property.
Ignore
If you want a field doesn't map to a column in table, you can use this annotation.
PrimaryKey
Annotation for define primary key for your entity(table). Defining a field with this annotation is necessary. Also an entity must have exactly one primary key. In other words, your entity must have exactly one field with this annotation. If your primary key variable type be int, you can set autoGenerate property to true. If autoGenerate property is set to true, the field type must be nullable and don't pass this field in object creation.