当前位置: 首页>>代码示例>>Java>>正文


Java SqlMapClient.queryForObject方法代码示例

本文整理汇总了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()));
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:22,代码来源:SqlMapClientImplModifierTest.java

示例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);
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:20,代码来源:IBatisCollectionAdapter.java

示例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;
}
 
开发者ID:wangym,项目名称:koubei-sharding,代码行数:17,代码来源:BaseShardingDAO.java

示例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);
}
 
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:11,代码来源:IbatisTest.java

示例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);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:IBatisProducer.java


注:本文中的com.ibatis.sqlmap.client.SqlMapClient.queryForObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。