Are there any functionality similar to the criteria API in MyBatis, or any wrapper like QueryDSL to provide this functionality over it?

At JPA/Hibernate we can write secure queries and accumulate our query predicates one step at a time. I believe that there is no equivalent in MyBatis , but is there any abstraction structure (e.g. QueryDSL ) that provides a layer above MyBatis that can allow us to write queries of type type. My main reason for requiring API criteria is that I need to build a query, each of which predicates comes from a separate logic.

+4
source share
2 answers

You can use MBG ( MyBatis Generator ) with sample classes .

Although I doubt that sample classes are as powerful as hibernate requests, they should do your job of building queries well.

+1
source

MyBatis Generator doesn't seem to like me. It is also necessary to generate classes from an existing database during assembly, which is rather cumbersome.

Is MyBatis SQL Builder Class the best solution?

+2
source

Source: https://habr.com/ru/post/1435884/


All Articles