use of com.ctrip.platform.dal.exceptions.DalException in project dal by ctripcorp.
the class DalSingleResultExtractor method extract.
@Override
public T extract(ResultSet rs) throws SQLException {
T result = null;
checkHints(rs);
if (rs.next()) {
result = mapper.map(rs, 0);
if (rs.next() && requireSingle)
throw new DalException(ErrorCode.AssertSingle);
}
return result;
}
use of com.ctrip.platform.dal.exceptions.DalException in project dal by ctripcorp.
the class BatchUpdateTask method createTaskContext.
@Override
public BulkTaskContext<T> createTaskContext(DalHints hints, List<Map<String, ?>> daoPojos, List<T> rawPojos) throws DalException {
BulkTaskContext<T> taskContext = new BulkTaskContext<T>(rawPojos);
Map<String, Boolean> pojoFieldStatus = taskContext.isUpdatableEntity() ? filterUpdatableEntity(hints, rawPojos) : filterNullColumns(hints, daoPojos);
if (pojoFieldStatus.size() == 0)
throw new DalException(ErrorCode.ValidateFieldCount);
taskContext.setPojoFieldStatus(pojoFieldStatus);
if (taskContext instanceof DalContextConfigure)
taskContext.setShardingCategory(shardingCategory);
return taskContext;
}
Aggregations