use of com.scalar.db.exception.transaction.TransactionException in project scalardb by scalar-labs.
the class JdbcTransactionIntegrationTest method populateRecords.
private void populateRecords() throws TransactionException {
JdbcTransaction transaction = manager.start();
IntStream.range(0, NUM_ACCOUNTS).forEach(i -> IntStream.range(0, NUM_TYPES).forEach(j -> {
Key partitionKey = new Key(ACCOUNT_ID, i);
Key clusteringKey = new Key(ACCOUNT_TYPE, j);
Put put = new Put(partitionKey, clusteringKey).forNamespace(NAMESPACE).forTable(TABLE).withValue(BALANCE, INITIAL_BALANCE);
try {
transaction.put(put);
} catch (CrudException e) {
throw new RuntimeException(e);
}
}));
transaction.commit();
}
use of com.scalar.db.exception.transaction.TransactionException in project scalardb by scalar-labs.
the class DistributedTransactionServiceWithConsensusCommitIntegrationTest method populateRecords.
private void populateRecords(String table) throws TransactionException {
GrpcTransaction transaction = manager.start();
IntStream.range(0, NUM_ACCOUNTS).forEach(i -> IntStream.range(0, NUM_TYPES).forEach(j -> {
Key partitionKey = new Key(ACCOUNT_ID, i);
Key clusteringKey = new Key(ACCOUNT_TYPE, j);
Put put = new Put(partitionKey, clusteringKey).forNamespace(NAMESPACE).forTable(table).withValue(BALANCE, INITIAL_BALANCE);
try {
transaction.put(put);
} catch (TransactionException e) {
throw new RuntimeException(e);
}
}));
transaction.commit();
}
Aggregations