Skip to content

@BindSqlTransaction

xcesco edited this page May 22, 2019 · 3 revisions

It's the annotation used in a DataSource interface to create static methods that define a set of operations that need to be managed as a single operation. A method annotated with this annotation can accept Daos that are used in the transaction and the external parameters. This kind of method has to return void. Given the following data source definition:

@BindDataSource(fileName="app.db", version=1, daoSet={DaoPerson.class})
public interface AppDataSource {

  @BindSqlTransaction
  static void execute(DaoPerson daoPerson, String name) {
   daoPerson.insert(new Person(-1, name, "Surname"));		
  }

}

For the method execute will be generated the method executeAsync (original name + Async suffix). The Dao parameters will be removed. In the generated data source you can call the following method:

BindAppDataSource ds = BindAppDataSource.getInstance();
Future<Boolean> result = ds.executeAsync("tonj");

The generated code will execute the transaction in another thread.

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