use of org.apache.ibatis.mapping.MappedStatement in project mybatis-3 by mybatis.
the class SimpleExecutor method doQueryCursor.
@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
Configuration configuration = ms.getConfiguration();
StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
Statement stmt = prepareStatement(handler, ms.getStatementLog());
return handler.<E>queryCursor(stmt);
}
use of org.apache.ibatis.mapping.MappedStatement in project mybatis-3 by mybatis.
the class SimpleExecutor method doUpdate.
@Override
public int doUpdate(MappedStatement ms, Object parameter) throws SQLException {
Statement stmt = null;
try {
Configuration configuration = ms.getConfiguration();
StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowBounds.DEFAULT, null, null);
stmt = prepareStatement(handler, ms.getStatementLog());
return handler.update(stmt);
} finally {
closeStatement(stmt);
}
}
use of org.apache.ibatis.mapping.MappedStatement in project mybatis-3 by mybatis.
the class XmlExternalRefTest method testMappedStatementCache.
@Test
public void testMappedStatementCache() throws Exception {
Reader configReader = Resources.getResourceAsReader("org/apache/ibatis/submitted/xml_external_ref/MapperConfig.xml");
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configReader);
configReader.close();
Configuration configuration = sqlSessionFactory.getConfiguration();
configuration.getMappedStatementNames();
MappedStatement selectPetStatement = configuration.getMappedStatement("org.apache.ibatis.submitted.xml_external_ref.PetMapper.select");
MappedStatement selectPersonStatement = configuration.getMappedStatement("org.apache.ibatis.submitted.xml_external_ref.PersonMapper.select");
Cache cache = selectPetStatement.getCache();
assertEquals("org.apache.ibatis.submitted.xml_external_ref.PetMapper", cache.getId());
assertSame(cache, selectPersonStatement.getCache());
}
use of org.apache.ibatis.mapping.MappedStatement in project mybatis-3 by mybatis.
the class ShortNameTest method ambiguousShortNameShouldFail.
@Test(expected = IllegalArgumentException.class)
public void ambiguousShortNameShouldFail() throws Exception {
Configuration configuration = getConfiguration();
// ambiguous short name should throw an exception.
MappedStatement ambiguousStatement = configuration.getMappedStatement("select");
fail("If there are multiple statements with the same name, an exception should be thrown.");
}
use of org.apache.ibatis.mapping.MappedStatement in project mybatis-3 by mybatis.
the class CacheOrderTest method shouldResolveACacheRefNotYetRead.
@Test
public void shouldResolveACacheRefNotYetRead() {
MappedStatement ms = sqlSessionFactory.getConfiguration().getMappedStatement("getUser");
Cache cache = ms.getCache();
assertEquals("org.apache.ibatis.submitted.cacheorder.Mapper2", cache.getId());
}
Aggregations