When have field with type LocalDateTime in Projection, get Projection type must be an interface! [DATACMNS-1847]
See original GitHub issueAiksandr opened DATACMNS-1847 and commented
In Spring boot 2.4.1 & 2.4.0
When use projection with field typed LocalDateTime
example
public interface Report { UUID getId(); LocalDateTime getCreateDate(); }
after fetch it from DB, get exception when try access to LocalDateTime field getCreateDate()
i made sample project, if You run it like usual Spring app, that will throw this exception https://github.com/Aiksandr/spring-jpa-demo
{{Caused by: java.lang.IllegalArgumentException: Projection type must be an interface! at org.springframework.util.Assert.isTrue(Assert.java:121) at org.springframework.data.projection.ProxyProjectionFactory.createProjection(ProxyProjectionFactory.java:105) at org.springframework.data.projection.SpelAwareProxyProjectionFactory.createProjection(SpelAwareProxyProjectionFactory.java:45) at org.springframework.data.projection.ProjectingMethodInterceptor.getProjection(ProjectingMethodInterceptor.java:160) at org.springframework.data.projection.ProjectingMethodInterceptor.potentiallyConvertResult(ProjectingMethodInterceptor.java:108) at org.springframework.data.projection.ProjectingMethodInterceptor.invoke(ProjectingMethodInterceptor.java:85) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)}}
And in previews versions it works ok
This issue already was reproduced in spring boot issue https://github.com/spring-projects/spring-boot/issues/24528)
Reference URL: https://github.com/spring-projects/spring-boot/issues/24528
Issue Links:
- DATACMNS-1836 Native projection stopped working with Java8 datetime (“duplicates”)
0 votes, 6 watchers
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12 (4 by maintainers)
Feel free to file a ticket directly against Spring Data JPA along with a minimal reproducible sample so we can specifically look into that issue. JPA typically returns the appropriate result and with a sample we can trace down the cause.
@NicklasWallgren please open a new issue, since this on e is closed.