-
Notifications
You must be signed in to change notification settings - Fork 16
@BindDataSourceOptions
xcesco edited this page Apr 26, 2018
·
3 revisions
Used to define data-source options with annotation. There are two ways to customize data source creating: by code or by annotation. This annotation implements the second way. When data-source is created, usually at application startup, it is possible to define some features: if it is in-memory, if DDL log is enabled, the populator and the migration-version tasks and so on.
To configure data source with @BindDataSourceOptions
just define data source as follows:
@BindDataSourceOptions(
logEnabled = true,
populator = PersonPopulator.class,
cursorFactory = PersonCursorFactory.class,
databaseLifecycleHandler=PersonLifecycleHandler.class,
updateTasks = {
@BindDataSourceUpdateTask(version = 2, task = PersonUpdateTask.class)
})
@BindDataSource(daoSet = { DaoPerson.class }, fileName = "app.db")
public interface AppWithConfigDataSource {
}
And the code for creating data source will become
// create data source
BindAppWithConfigDataSource ds=BindAppWithConfigDataSource.instance();
- cursorFactory: cursorFactory
- databaseErrorHandler: databaseErrorHandler
- databaseLifecycleHandler: databaseLifecycleHandler
- inMemory: if true, generate database in memory.
- logEnabled: Log enabled. This flag controls log that is not generated by annotation processor, but the log associated to database operation like open/close connnections, create tables and so on.
- populator: is executed after database creation.
- updateTasks: Allows to specify migration task between versions.
- Introduction
- Goals & Features
- Kotlin
- Immutable or Mutable Pojo
- Annotation Processor Args
- Credits
- Articles
- Benchmarks
- Setup
- Tutorial
- Usage
- Dependencies and inspirations
- Stackoverflow
- Documentation
- SQL logging
- Data source options
- Indices
- SQL Type adapter
- Global SQL Type adapter
- Constraints
- Live data: welcome Architectural components!!
- Paged Live data
- Dynamic parts
- Transactional and batch operations
- Async Transactional and batch operations
- Global transaction
- Support for immutable POJO
- Generate Content provider
- Generate Database schema generation
- Database migration
- BindSqlColumn
- BindContentProvider
- BindContentProviderEntry
- BindContentProviderPath
- BindDao
- BindDaoMany2Many
- BindDataSource
- BindDataSourceOptions
- BindDataSourceUpdateTask
- BindIndex
- BindSqlRelation
- BindSqlAdapter
- BindSqlChildSelect
- BindSqlDelete
- BindSqlDynamicOrderBy
- BindSqlDynamicWhere
- BindSqlDynamicWhereParams
- BindSqlInsert
- BindSqlPageSize
- BindSqlParam
- BindSqlSelect
- BindSqlUpdate
- BindSqlType
- BindSqlTransaction