2

聊一聊:MyBatis和Spring Data JPA的选择问题

 3 years ago
source link: http://blog.didispace.com/spring-data-jpa-vs-mybatis/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

从个人开发角度来说,Spring Data JPA更好用,是因为开发起来更快。

但从团队角度,我们希望更好的维护性,spring data jpa就差一些,或者说对后期人的要求更高。

很容易出现这种情况:

监控系统发现某个慢查询了,运维把SQL发到开发群里,大家自查一下。此时很可能发现根本没人回应,都说没有这句SQL。然后运维定位到某个库,找到这个库的使用人,让他去看。他可能也就拿着SQL全局去搜,发现还是搜不到。

如果这个人责任心不强,可能就说 没找到这个SQL,责任心强调的,对Spring Data JPA熟悉点的,就要开始去分析这个SQL可能在哪里,然后找到对应的实现地方去修改。

这就是Spring Data JPA在团队作战时候,容易引发维护成本高的真实场景。

P.S. 我开发自己独立产品的时候,还是喜欢用它的,因为自己再熟悉不过,不会有这样的场景。所以果断选择,但团队作战,我还是会选在MyBatis。

那么你怎么看呢?

因个人备案要求,博客已经下掉评论区,所以可以在这里留言讨论: 传送门


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK