Spring Data dynamic query

耗尽温柔 提交于 2019-12-04 01:28:00
gipinani

Yes. @Query supports pageable.. and yes there's another way to accomplish this.

You could take a look at building query with criteria, that allow you add AND / OR where conditions dynamically. I actually use querydsl to facilitate my development.

In this post you can find a good explanation of both: http://spring.io/blog/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/

Altough it could be seem more complex at beginning, the use of this feature will make your code more consistent with increasing complexity

Use Spring Data JPA Querydsl. Read it here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!