I am relatively new in MyBatis. The select queries are working fine. But the delete queries and not working.
Mapper.xml
<delete id="deleteEntry" parameterType="java.util.HashMap" >
delete from table where user_id = #{userId} and application_id = #{appId}
</delete>
Mapper.java
public interface Mapper {
public Integer deleteEntry(@Param("userId") long userId, @Param("appId") long appId);
}
The DAO where I am calling the function looks like this.
SqlSession sqlSession = MyBatisUtil.getSqlSessionFactory().openSession();
try{
LOG.info("Records Deleted: "+sqlSession.getMapper(Mapper.class).deleteEntry(userId,appId));
}
finally {
sqlSession.close();
}
Now the result is Records Deleted: 1
However when i check the database, the row hasn't been deleted. I am using Sql Server.
Thank you for the help in advance. :)
1条答案
按热度按时间zkure5ic1#
Set auto-commit to true