-
Notifications
You must be signed in to change notification settings - Fork 682
When have field with type LocalDateTime in Projection, get Projection type must be an interface! [DATACMNS-1847] #2260
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
Comments
Any news ? This is a breaking change for us too. |
@christophstrobl Since you worked on that issue |
Fixed via #479 included in spring-data 2.4.3, picked up by Spring Boot 2.4.2 |
As previous comment says, conversion of custom objects is now broken.
with standard Throws projection type must be an interface! during call of X.getMyObject(). |
Complex object conversion was never subject to the conversion service used for projections. The conversion service can adjust for slight conversions ( The underlying entity is what dictates the type that needs to be used in your projection. Alternatively, use SpEL through |
Umm, the code worked in Spring Boot 2.2.10, so it was jut unintended "side effect" and we are supposed to Use Or did own conversion? |
I have to clarify, the projection is used in native query. |
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. |
We're still seeing this issue while trying to upgrade from spring boot 2.3.8 to 2.4.3. The projection in question includes two |
The issue in my case particular case was that the column property was defined as |
@NicklasWallgren please open a new issue, since this on e is closed. |
Aiksandr 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 spring-projects/spring-boot#24528)
Reference URL: spring-projects/spring-boot#24528
Issue Links:
("duplicates")
0 votes, 6 watchers
The text was updated successfully, but these errors were encountered: