本文整理汇总了Java中org.apache.ibatis.session.SqlSessionException类的典型用法代码示例。如果您正苦于以下问题:Java SqlSessionException类的具体用法?Java SqlSessionException怎么用?Java SqlSessionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlSessionException类属于org.apache.ibatis.session包,在下文中一共展示了SqlSessionException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldInstantiateAndThrowAllCustomExceptions
import org.apache.ibatis.session.SqlSessionException; //导入依赖的package包/类
@Test
public void shouldInstantiateAndThrowAllCustomExceptions() throws Exception {
Class<?>[] exceptionTypes = {
BindingException.class,
CacheException.class,
DataSourceException.class,
ExecutorException.class,
LogException.class,
ParsingException.class,
BuilderException.class,
PluginException.class,
ReflectionException.class,
PersistenceException.class,
SqlSessionException.class,
TransactionException.class,
TypeException.class,
ScriptingException.class
};
for (Class<?> exceptionType : exceptionTypes) {
testExceptionConstructors(exceptionType);
}
}
示例2: count
import org.apache.ibatis.session.SqlSessionException; //导入依赖的package包/类
/**
* 统计匹配的总记录数
*
* @param mapperId
* @param object
* @return
*/
@Override
public int count(String mapperId, Object object) {
Integer integer = getSqlSessionTemplate().selectOne(mapperId, object);
if(integer == null){
throw new SqlSessionException("Error: Sql statement is only support select count/sum from tablename. Please check sql statement");
}
return integer;
}