spring-data-jpa Spring JPA Query By Example return error in case all values are null

ia2d9nvy  于 2022-11-10  发布在  Spring
关注(0)|答案(1)|浏览(141)

I'm using Spring JPA Query By Example to allow dynamic filters. However I notice that if the example object has all the values set a null, the example query returns all the values of the table.
I cannot add mandatory field, since the queries must be complete dynamic, also pagination is not an option.
Therefore I wanted to ask if there is a way to tell JPA that if all the values in the probe example are null to return a error o execute some kind of fall back operation.

dced5bon

dced5bon1#

No, such a setting does not exist, you'd have to check that yourself up front.

相关问题