Closed dabico closed 1 year ago
Fundamentally speaking, ExampleSpecification
is an implementation detail to provide support for Query by Example.
I'd really to understand the use case you are attempting to solve that begs you to make changes and alterations to ExampleSpecification
.
Hi @gregturn
In short, I wanted to create an extension to the Specification
and Example
query APIs to support Stream
.
Here are the methods and signatures: https://github.com/seart-group/DL4SE/blob/274dbefd77f16b00cdace01d87a399a8308c7915/dl4se-server/src/main/java/ch/usi/si/seart/server/repository/support/JpaStreamExecutor.java
Here is the custom repository implementation: https://github.com/seart-group/DL4SE/blob/274dbefd77f16b00cdace01d87a399a8308c7915/dl4se-server/src/main/java/ch/usi/si/seart/server/repository/support/ExtendedJpaRepositoryImpl.java
I would not be making changes to the class itself, in fact, it can be final
for all I care, so long as its visible and can be instantiated from this custom SimpleJpaRepository
extension.
Have you seen that you have all of this flexibility if you use the fluent findBy(Specification, q -> q.stream())
or findBy(Example, q -> q.stream())
API?
Have you seen that you have all of this flexibility if you use the fluent
findBy(Specification, q -> q.stream())
orfindBy(Example, q -> q.stream())
API?
HI @mp911de
I was not aware of this API, when was it introduced? I'm still on SB 2.7, and I don't think our organization will migrate to 3.X in the near future.
It has been introduced with version 3.0. Spring Data JPA 2.7 has reached its OSS EOL by now (Nov 2023) and we will ship only one final OSS release. We generally avoid updates to API that has been released as changes to API that is available for quite a while asks for trouble.
Given that update, I'm closing the ticket.
Would it be possible to increase the visibility of
SimpleJpaRepository.ExampleSpecification
fromprivate
toprotected
? I'm developing a custom repository that extendsSimpleJpaRepository
, and would like to reuse this inner class as opposed to copying it from the parent. The class in question:https://github.com/spring-projects/spring-data-jpa/blob/018c2acd86d0a901353036dcdf44eda0bc625bca/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/SimpleJpaRepository.java#L953-L987