List of usage examples for org.apache.ibatis.session SqlSession selectMap
<K, V> Map<K, V> selectMap(String statement, String mapKey);
From source file:com.baidu.oped.apm.plugin.mybatis.SqlSessionTestBase.java
License:Apache License
protected final void testAndVerifySelectMap() throws Exception { // Given//www. ja v a2 s . c o m final String selectMapId = "selectListId"; SqlSession sqlSession = getSqlSession(); // When sqlSession.selectMap(selectMapId, "key"); sqlSession.selectMap(selectMapId, new Object(), "key"); sqlSession.selectMap(selectMapId, new Object(), "key", RowBounds.DEFAULT); // Then PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); Method selectMap1 = sqlSession.getClass().getDeclaredMethod("selectMap", String.class, String.class); Method selectMap2 = sqlSession.getClass().getDeclaredMethod("selectMap", String.class, Object.class, String.class); Method selectMap3 = sqlSession.getClass().getDeclaredMethod("selectMap", String.class, Object.class, String.class, RowBounds.class); verifier.verifyTrace(event("MYBATIS", selectMap1, Expectations.cachedArgs(selectMapId))); verifier.verifyTrace(event("MYBATIS", selectMap2, Expectations.cachedArgs(selectMapId))); verifier.verifyTrace(event("MYBATIS", selectMap3, Expectations.cachedArgs(selectMapId))); }
From source file:net.hasor.db.orm.mybatis3.SqlExecutorTemplate.java
License:Apache License
public <K, V> Map<K, V> selectMap(final String statement, final String mapKey) throws SQLException { return this.execute(new SqlSessionCallback<Map<K, V>>() { public Map<K, V> doSqlSession(SqlSession sqlSession) { return sqlSession.selectMap(statement, mapKey); }//w w w . j a v a 2 s .com }); }