Skip to content

@BindDaoMany2Many

xcesco edited this page Apr 26, 2018 · 3 revisions

This annotation allows to easily manage many 2 many relationships. You can read Many-to-many page for a detailed explanation how it works.

Attributes

  • idName: allows to specify primary key name. Default value is id.
  • tableName: Name of the table, in SQLite style (with words underline separator). It will be converted during creation of table. If null (default value), the name of the table will be the transformed class name.
  • where: where condition. It is possible to specify a parameter bound to method's parameter with the syntax ${<parameter name>}.
  • entity1: referred entity 1.
  • entity2: referred entity 2.
  • methods: if true (default value), it will generate standard methods for the dao:
    • Insert bean
    • Select bean by foreign key 1
    • Select bean by foreign key 2
    • Select bean by id
    • Delete bean by foreign key 1
    • Delete bean by foreign key 2

Usage

Suppose we want to put in relation two entities: Person and City. @BindDaoMany2Many allows easily to define a relation between them simply creating the following DAO interface:

@BindDaoMany2Many(entity1 = City.class, entity2 = Person.class)
public interface City2PersonDao {

}

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