use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DalQueryDaoTest method testQueryForObjectAllShardsWithClass.
@Test
public void testQueryForObjectAllShardsWithClass() {
try {
DalHints hints = new DalHints();
StatementParameters parameters = new StatementParameters();
parameters.set(1, 1);
Integer result = dao.queryForObject(sqlObject, parameters, hints.inAllShards(), Integer.class);
assertEquals(1, result.intValue());
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DalQueryDaoTest method testQueryFirstAllShardsWithClass.
@Test
public void testQueryFirstAllShardsWithClass() {
try {
DalHints hints = new DalHints();
StatementParameters parameters = new StatementParameters();
parameters.set(1, 1);
Integer result = dao.queryFirst(sqlFirst, parameters, hints.inAllShards(), Integer.class);
assertEquals(1, result.intValue());
} catch (Exception e) {
fail();
}
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DalQueryDaoTest method queryFirstInAllShardPartial.
private ClientTestModel queryFirstInAllShardPartial(DalHints hints) throws SQLException {
StatementParameters parameters = new StatementParameters();
parameters.set(1, 1);
return dao.queryFirst(sqlFirst, parameters, hints.inAllShards().partialQuery("quantity", "address"), new DalDefaultJpaMapper<>(ClientTestModel.class));
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DalQueryDaoTest method testQueryFirstAllShardsNullable.
@Test
public void testQueryFirstAllShardsNullable() {
try {
DalHints hints = new DalHints();
StatementParameters parameters = new StatementParameters();
ClientTestModel result = dao.queryFirstNullable(sqlNoResult, parameters(), hints.inAllShards(), new ClientTestDalRowMapper());
assertNull(result);
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DalQueryDaoTest method testQueryForObjectAllShardsWithClassAsync.
@Test
public void testQueryForObjectAllShardsWithClassAsync() {
try {
DalHints hints = new DalHints();
StatementParameters parameters = new StatementParameters();
parameters.set(1, 1);
Integer result = dao.queryForObject(sqlObject, parameters, hints.inAllShards().asyncExecution(), Integer.class);
assertNull(result);
Future<Integer> fr = (Future<Integer>) hints.getAsyncResult();
result = fr.get();
assertEquals(1, result.intValue());
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
Aggregations