NullPointerException
when using Specification.where(null)
with CriteriaBuilder
#3738
Labels
status: invalid
An issue that we don't feel is valid
Hi, I wanted to to use
Specification.where(null)
as a "match all"org.springframework.data.jpa.domain.Specification
(a specification without any restriction).But I get a
NullPointerException
inside Hibernate code when using it with aCriteriaBuilder
:Stack trace :
Argument of
Specification#where(Specification<T>)
is marked as@Nullable
so I thought this should have worked.Also, using this specification with a
JpaRepository
/JpaSpecificationExecutor
(taskRepository.findAll(Specification.where(null))
) seems to work fine as a "match all" query.Also, I found a workaround:
I have created a minimal Maven project with tests to reproduce the bug : https://github.com/loic-brtd/hibernate-bug-specification-to-predicate.
I'm using :
org.springframework.data:spring-data-jpa:3.4.1
org.hibernate.orm:hibernate-platform:6.6.4.Final
The text was updated successfully, but these errors were encountered: