其他
诡异!MyBatis的Insert方法一直返回"-2147482646"?
大家好,我是D哥
点击关注下方公众号,Java面试资料 都在这里
# 操作
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg name="sqlSessionFactory" ref="sqlSessionFactory"></constructor-arg>
<!-- 执行类型 -->
<constructor-arg name="executorType" value="SIMPLE"></constructor-arg>
</bean>
Reader config = Resources.getResourceAsReader("conf.xml");
SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(config);
SqlSession sqlSession = sessionFactory.openSession();
String sql = "com.mlxs.mybatis.test.userMapper.insertUser";
int res= sqlSession.insert(sql, "1");//
public interface SqlSession extends Closeable {
int insert(String var1);
int insert(String var1, Object var2);
}