Query creation in Spring Data - dynamic where clause

前端 未结 3 1484
没有蜡笔的小新
没有蜡笔的小新 2021-01-06 03:47

Is there a way in Spring data to dynamically form the where clause?

What I want to do is have a method (which is like the findBy / get method) which runs a WHERE and

3条回答
  •  醉梦人生
    2021-01-06 04:31

    Take a look at JPA Specification and Predicate, and Even better QueryDSL, there both supported by spring data repositories. This article provide an example: http://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/

提交回复
热议问题