Skip to content

When have field with type LocalDateTime in Projection, get Projection type must be an interface! [DATACMNS-1847] #2260

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

  • DATACMNS-1836 Native projection stopped working with Java8 datetime
    ("duplicates")

0 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions