对于 Spring 2.5.6 及以上版本,我能想到的选择 spring jdbc 的两个原因是:
- BeanPropertySqlParameterSource - 用于 插入/更新
- ParameterizedBeanPropertyRowMapper - 用于选择
这两个为您提供了基本 orm 的功能,因为您不需要编写行映射器。
想法/评论?
最佳答案
IBatis 为您提供 caching开箱即用,而 SpringJDBC 则不然。有些人可能更喜欢使用声明性方法(在 IBatis 中是 XML)来定义他们的查询。使用左连接 populate 1:n relationships without running n+1 selects使用 IBatis 可能会更容易完成。最后,您可以在同一个项目中使用这两种方法,并根据您想要解决的问题选择您选择的框架。
关于ibatis - Spring jdbc 与 iBatis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3422598/