Skip to content

For derived queries support OffsetDateTime and LocalTime #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Skym0sh0 opened this issue Apr 5, 2023 · 1 comment
Closed

For derived queries support OffsetDateTime and LocalTime #2706

Skym0sh0 opened this issue Apr 5, 2023 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@Skym0sh0
Copy link

Skym0sh0 commented Apr 5, 2023

I have a data class that contains some timestamps with the type java.time.OffsetDateTime.
Now I want to write (or better to say: let generate) a derived query that does filtering with isBefore and isAfter on such a OffsetDateTime field.

When those queries are generated I receive an error that isBefore/isAfter can not be used together with OffsetDateTime.

Caused by: java.lang.IllegalArgumentException: Can not derive query for 'public abstract java.util.List my.package.MyExampleRepository.findByLastModifiedDateIsAfter(java.time.OffsetDateTime)': The keywords [IsAfter, After] work only with properties with one of the following types: [class java.time.Instant, class java.time.LocalDate, class java.time.LocalDateTime, class java.time.OffsetTime, class java.time.ZonedDateTime].
	at org.springframework.util.Assert.isTrue(Assert.java:139)
	at org.springframework.data.neo4j.repository.query.PartValidator.validateTemporalProperty(PartValidator.java:116)
	at org.springframework.data.neo4j.repository.query.PartValidator.validatePart(PartValidator.java:82)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.data.neo4j.repository.query.PartTreeNeo4jQuery.<init>(PartTreeNeo4jQuery.java:60)
	at org.springframework.data.neo4j.repository.query.PartTreeNeo4jQuery.create(PartTreeNeo4jQuery.java:50)
	at org.springframework.data.neo4j.repository.query.Neo4jQueryLookupStrategy.resolveQuery(Neo4jQueryLookupStrategy.java:70)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:103)

When looking at the error message I am asking myself:
Why is OffsetDateTime and LocalTime not supported?
Why is OffsetTime (which I never heard of yet) supported?
What can I do as a workaround?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 5, 2023
@michael-simons michael-simons self-assigned this Apr 11, 2023
@michael-simons
Copy link
Collaborator

This is most likely an oversight or left over from older versions of the underlying driver not converting these types proper. Will be fixed shortly.

@michael-simons michael-simons added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 11, 2023
@michael-simons michael-simons added this to the 6.3.11 (2021.2.11) milestone Apr 11, 2023
michael-simons added a commit that referenced this issue Apr 11, 2023
Recent drivers support them without issues and don’t need separate conversions. Closes #2706.
michael-simons added a commit that referenced this issue Apr 11, 2023
Recent drivers support them without issues and don’t need separate conversions. Closes #2706.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants