Skip to content

@BindSqlType

xcesco edited this page May 14, 2018 · 2 revisions

This annotation allows to manage the class as data model and will instruct Kripton to generate an associated table in the data source that contains it. This annotation allows to specify the table name and the

When a class is converted to a table, the name of the table is obtained from Java class name with an upper camel to Lower underscore conversion. For example SayHello class name will be transformed into say_hello table name.

This annotation allows specifying the name of the associated table associated with a Java class. Note that specified name will be transformed like a Java class name.

Attributes

  • indexes: allows defining indexes on the table. See @BindIndex for more informations.
  • name: name of the table.

Usage

@BindSqlType(
  name="ws_bean",
  indexes= {
    @BindIndex({"birthCity", "birthDay desc"}),
    @BindIndex({"surname"}),
    @BindIndex(value={"name","surname", "date desc"}, unique=true )
  }
)
public class Person {
  ...
}

Its associated table name is ws_bean and it will generate the following table definition:

CREATE TABLE ws_bean (id INTEGER PRIMARY KEY AUTOINCREMENT, alias_name TEXT UNIQUE, date TEXT, name TEXT, surname TEXT, birth_city TEXT, birth_day TEXT); 
CREATE INDEX idx_person_name ON person(name); CREATE INDEX idx_person_surname ON person(surname); 
CREATE UNIQUE INDEX idx_person_0 on person (name, surname, date desc); 
CREATE INDEX idx_person_0 on person (birth_city, birth_day desc); 
CREATE INDEX idx_person_1 on person (surname);

Table of Contents

Query definition

Features

Relations

Multithread supports

Modularization

Annotations for data convertion

Annotations for SQLite ORM

Annotations for shared preferences

Clone this wiki locally