-
Notifications
You must be signed in to change notification settings - Fork 16
@BindSqlRelation
For default, every field defined in a class that belongs to the data model of a data source is included as the column in the associated database table. If you don't want to include a particular field into the table, just decorate the field with @BindDisabled or set to false
@BindSqlColumn#enabled.
When we work with relationship, it happens that you referer from the parent entity the children entities with a collection field. An example:
@BindTable
public class Album {
public long id;
@BindSqlColumn(enabled=false)
public List<Song> songs;
}
@BindTable
public class Song {
public long id;
@BindSqlColumn(parentEntity=Album .class, nullable=false)
public long albumId;
}
There is another way to avoid the inclusion of songs
field in table album
: using @BindRelation. With this annotation, we inform the Kripton Annotation Processor that the field is not to be inserted in table AND that it can be used to generate child queries.
@BindTable
public class Album {
public long id;
@BindSqlRelation
public List<Song> songs;
}
@BindTable
public class Song {
public long id;
@BindSqlColumn(parentEntity=Album .class, nullable=false)
public long albumId;
}
This annotation can be used on List or Set type field. If you remove BindSqlRelation
it will be inserted as BLOB.
- 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