Comments (3)
I'll give you all details :
Spring-jata-jpa : 3.2.5
Kotlin : 1.9.23
I'm trying to play this code :
fun isToDelete(): Specification<Request> {
return Specification<Entity> { root, _, builder ->
LocalDateTime.now().minusDays(120)?.let { builder.lessThanOrEqualTo(root.get("date"), it) }
}
}
fun delete() = entityRepository.delete(isToDelete())
But on the code of SimpleJpaRepository that implement the JpaSpecificationExecutor I hit the following line of code :
Predicate predicate = spec.toPredicate(delete.from(getDomainClass()), null, builder);`
with that interface :
@Nullable
Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder);
I suspect that Kotlin don't take @nullable when compiling those java class and a NPE happen because "null" is literally passed to a non null parameter.
from spring-data-jpa.
Thanks for reporting. Care to give us a bit more context of what you're trying to archive?
I do see a potential nullability contract violation with Specification#toPredicate
when no CriteriaQuery
is present due to CriteriaBuilder#createCriteriaDelete(Class)
not implementing it.
from spring-data-jpa.
That's a shortcoming of the Specification vs. Criteria Query design. Specifications have been designed for select queries and at some point, we enabled these for delete
usage. We cannot provide a CriteriaQuery
as CriteriaDelete
isn't assignable into it. It's a duplicate of #3036.
At some point, we need to revisit our arrangement and find a path forward.
from spring-data-jpa.
Related Issues (20)
- entity basePackages in third-party jars HOT 2
- Add `camelCase` to `snake_case` fallback for native query projections HOT 6
- 3.2.x Auditing behavior fails with composite keys using @IdClass but succeeds with @Embeddable HOT 3
- Unexpected Quoting on Column Name after Spring Boot 3 Migration HOT 3
- findById ignores @SQLRestriction annotation when performed in the same transaction as the save HOT 8
- The getId method was not called HOT 2
- Upgrade to Hibernate 6.5.1 HOT 1
- Remove duplicate plugin setup from parent pom.
- Invalid value for NanoOfSecond between 12am and 1am HOT 2
- Sorting of Pageable.unpaged(sort) is ignored by JPA Repository HOT 2
- Different `property` is used in `Sort.Order` method HOT 2
- Upgrade to Hibernate 6.2.25.Final
- Upgrade to Hibernate 6.4.8.Final
- Release 3.2.7 (2023.1.7)
- Release 3.3.1 (2024.0.1)
- Release 3.4 M1 (2024.1.0)
- 3.2.5 - Issue with dropping unexisting tables with ddl-auto=create HOT 1
- Upgrade to Jakarta Persistence 3.2
- Can I use global query comment instead `@QueryHint` or `@Meta`? HOT 2
- Specification using enum values does not follow `@Enumerated(EnumType.STRING)` and tries to convert it to smallint HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-jpa.