spring-data-relational icon indicating copy to clipboard operation
spring-data-relational copied to clipboard

Integration Mybatis with spring-data-jdbc,make mybatis can mixed with spring-data-jdbc in ONE repository [DATAJDBC-373]

Open spring-projects-issues opened this issue 5 years ago • 6 comments

neil4dong opened DATAJDBC-373 and commented

Integration Mybatis with spring-data-jdbc,make mybatis can mixed with spring-data-jdbc in ONE repository by annotation with @MybatisQuery

Please check out if this way is feasible ? In my case we currently use mybatis for data access, and we are considering to migrate to spring-data-jdbc, but we have a lot of complex SQL which organized by Mybatis.

Considering the migration cost, how about use mybaitis and spring-data-jdbc together, so we can benefit form

  1. the simplicity provided form spring-data-jdbc
  2. another complex SQL solution provided by mybatis (which now only provided by QueryDsl)

Referenced from: pull request https://github.com/spring-projects/spring-data-jdbc/pull/152

spring-projects-issues avatar May 16 '19 08:05 spring-projects-issues

José Miguel Sanz García commented

Agree with neil4dong. Once you have MyBatis integrated to do simple statements, why not use it to it's full potential?

Anyone would argue: ok but you can use MyBatis in parallel with Spring Data JDBC to retrieve entities using complex queries. Against that I would say that it would be a lot cleaner to access MyBatis queries through DataJDBC repositories having all the code well organized instead of having both DataJDBC and MyBatis mapper classes

spring-projects-issues avatar Jul 15 '19 08:07 spring-projects-issues

Jens Schauder commented

If I understand this comment on the PR correct, there is a nice way to integrate MyBatis with Spring Data JDBC just through custom method implementations.

This sounds preferable to me than having an extra feature, that needs maintaining

spring-projects-issues avatar Oct 28 '20 07:10 spring-projects-issues

This is nice idea.... is this in the plan?

samyc1201 avatar May 21 '21 11:05 samyc1201

The PR involved in this issue makes me confused. Is it trying to introduce the concept of BaseMapper similar to baomidou's Mybatis Plus to directly provide additional methods for Mapper?

linghengqian avatar May 10 '22 08:05 linghengqian

The PR involved in this issue makes me confused. Is it trying to introduce the concept of BaseMapper similar to baomidou's Mybatis Plus to directly provide additional methods for Mapper?

maybe like this #1312

CuriousRookie avatar Nov 15 '23 09:11 CuriousRookie