本文整理汇总了Java中com.ibatis.sqlmap.client.SqlMapClient.queryForObject方法的典型用法代码示例。如果您正苦于以下问题:Java SqlMapClient.queryForObject方法的具体用法?Java SqlMapClient.queryForObject怎么用?Java SqlMapClient.queryForObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibatis.sqlmap.client.SqlMapClient
的用法示例。
在下文中一共展示了SqlMapClient.queryForObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryForObjectShouldBeTraced
import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类
@Test
public void queryForObjectShouldBeTraced() throws Exception {
// Given
SqlMapClient sqlMapClient = new SqlMapClientImpl(this.mockSqlMapExecutorDelegate);
// When
sqlMapClient.queryForObject("abrgrgfdaghertah", new Object());
// Then
final List<SpanEventBo> spanEvents = getCurrentSpanEvents();
assertThat(spanEvents.size(), is(1));
// Check Method
final SpanEventBo apiCallSpanEventBo = spanEvents.get(0);
assertThat(apiCallSpanEventBo.getApiId(), not(0));
// Check Parameter
final List<AnnotationBo> annotationBoList = apiCallSpanEventBo.getAnnotationBoList();
assertThat(annotationBoList.size(), is(1));
final AnnotationBo parameterAnnotationBo = annotationBoList.get(0);
assertThat(parameterAnnotationBo.getKey(), is(AnnotationKey.CACHE_ARGS0.getCode()));
}
示例2: retrieveEntry
import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Entry retrieveEntry(RequestContext request, Object entryId)
throws FeedServerAdapterException {
String queryId = config.getFeedId() + "-get-entry";
SqlMapClient client = getSqlMapClient();
Map<String, Object> row;
try {
row = (Map<String, Object>) client.queryForObject(queryId, entryId, getRequestParams(request));
} catch (SQLException e) {
throw new FeedServerAdapterException(
FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
}
if (row == null) {
// didn't find the entry.
return null;
}
return createEntryFromProperties(null, row);
}
示例3: queryForObject
import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类
@Override
public Object queryForObject(Object shardingId, String sqlMapId) throws Exception {
Object result = null;
String[] array = getShardingArray(shardingId);
if (null != array && 0 < array.length) {
String dbName = array[0];
SqlMapClient sqlMapClient = shardingStrategy.getSqlMapClientByDbName(dbName);
if (null != sqlMapClient) {
result = sqlMapClient.queryForObject(sqlMapId);
}
}
return result;
}
示例4: testSimple
import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类
@Test
public void testSimple() throws SQLException, IOException {
String resource = "org/n3r/sandbox/db/ibatis/sqlmap-config.xml";
Reader reader = Resources.getResourceAsReader(resource);
SqlMapClient sqlmap = SqlMapClientBuilder.buildSqlMapClient(reader);
HashMap<String, String> param = new HashMap<String, String>();
param.put("dataId", "a");
Object obj = sqlmap.queryForObject("test1", param);
System.out.println(obj);
}
示例5: doQueryForObject
import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类
private void doQueryForObject(Exchange exchange) throws Exception {
SqlMapClient client = endpoint.getSqlMapClient();
Object result;
Object in = exchange.getIn().getBody();
if (in != null) {
LOG.trace("QueryForObject: {} using statement: {}", in, statement);
result = client.queryForObject(statement, in);
} else {
LOG.trace("QueryForObject using statement: {}", statement);
result = client.queryForObject(statement);
}
doProcessResult(exchange, result);
}