Search in sources :

Example 1 with BoundStatementMapper

use of org.simpleflatmapper.datastax.BoundStatementMapper in project SimpleFlatMapper by arnaudroger.

the class DatastaxCrudFactory method keySetter.

private static <K> BoundStatementMapper<K> keySetter(Type keyTarget, TableMetadata tableMetadata, DatastaxMapperFactory mapperFactory, int offset) {
    SettableDataMapperBuilder<K> mapperBuilder = mapperFactory.newBuilderFrom(keyTarget);
    int i = offset;
    for (ColumnMetadata columnMetadata : tableMetadata.getPrimaryKey()) {
        mapperBuilder.addColumn(DatastaxColumnKey.of(columnMetadata, i++));
    }
    return new BoundStatementMapper<K>(mapperBuilder.mapper());
}
Also used : ColumnMetadata(com.datastax.driver.core.ColumnMetadata) BoundStatementMapper(org.simpleflatmapper.datastax.BoundStatementMapper)

Example 2 with BoundStatementMapper

use of org.simpleflatmapper.datastax.BoundStatementMapper in project SimpleFlatMapper by arnaudroger.

the class DatastaxCrudFactory method insertSetter.

private static <T> BoundStatementMapper<T> insertSetter(Type target, TableMetadata tableMetadata, DatastaxMapperFactory mapperFactory, int offset) {
    SettableDataMapperBuilder<T> mapperBuilder = mapperFactory.newBuilderFrom(target);
    int i = offset;
    for (ColumnMetadata columnMetadata : tableMetadata.getColumns()) {
        mapperBuilder.addColumn(DatastaxColumnKey.of(columnMetadata, i++));
    }
    return new BoundStatementMapper<T>(mapperBuilder.mapper());
}
Also used : ColumnMetadata(com.datastax.driver.core.ColumnMetadata) BoundStatementMapper(org.simpleflatmapper.datastax.BoundStatementMapper)

Aggregations

ColumnMetadata (com.datastax.driver.core.ColumnMetadata)2 BoundStatementMapper (org.simpleflatmapper.datastax.BoundStatementMapper)2