Question

There is an update method in iBatis SqlMapClientTemplate that allows to specify how many rows are expected to be updated (and throws exception if this is not matched).

Is there any equivalent to this method in MyBatis' sqlSession? Those docs suggest there isn't.

What is the best way to implement such a check the other way?

Was it helpful?

Solution 2

Just came back to that question and realized that it was really trivial.

Source code of iBatis' overloaded update just calls the regular update(String, Object) and checks returned value.

As myBatis also has update(String, Object), this can be simply implemented the same way. Simplicity of this method was probably the reason to drop its support in myBatis.

OTHER TIPS

There's no such equivalent method in mybatis' spring extension

http://mybatis.github.io/spring/apidocs/reference/org/mybatis/spring/SqlSessionTemplate.html

Maybe you can raise it as an issue or submit as a pull request to the team :P

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top