spring-projects / spring-data-relational

Spring Data Relational. Home of Spring Data JDBC and Spring Data R2DBC.
https://spring.io/projects/spring-data-jdbc
Apache License 2.0
771 stars 346 forks source link

Add support for named queries backed by MyBatis [DATAJDBC-362] #586

Open spring-projects-issues opened 5 years ago

spring-projects-issues commented 5 years ago

tonyfalabella opened DATAJDBC-362 and commented

As noted on jdbc.mybatis, Spring Data JDBC provides functionality for the `CrudRepository ` methods to call out to MyBatis. 

 

For each operation in CrudRepository, Spring Data JDBC runs multiple statements. If there is a SqlSessionFactory in the application context, Spring Data checks, for each step, whether the SessionFactory offers a statement. If one is found, that statement (including its configured mapping to an entity) is used.

 

For those interested in the repository being able to call out to MyBatis for additional named queries it does not yet provide such support.  Having such functionality would allow MyBatis users to take advantage of the generic Repository interface and all the additional features Spring Data provides (i.e. spring-data-rest-webmvc).

The functionality provided should allow the caller to not only pass objects of `MyBatisContext ` but also allow passing in whatever arguments the method requires.  It appears that Spring Data MyBatis provides additional capabilities but it's not developed by Spring/Pivotal and as-such it's difficult to use this library within certain organizations. 

Additional info is on StackOverflow: spring-data-jdbc-with-mybatis-not-finding-custom-query


Affects: 1.1 M3 (Moore)

1 votes, 1 watchers

schauder commented 1 month ago

See #598