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
ETag getVersionInformation fails with proxied Entities for projections [DATAREST-581] #955
Comments
Oliver Drotbohm commented Do you have a stack trace handy? Actually all request preparing code should see the actual domain object, not a projection but I'd have a look |
Tim te Beek commented There's no stacktrace that shows up in the app-server log, just a 500 response to the client. It's a simple IllegalArgumentException that's thrown with the message:
|
Oliver Drotbohm commented Okay, a reproducing sample project maybe? |
Tim te Beek commented See reference url: https://github.com/timtebeek/etag-projection |
Oliver Drotbohm commented Doh! Stupid me… I'll have a look |
Tim te Beek commented Saw some linked commits already; Thanks for looking into this! |
Oliver Drotbohm commented I just wanted to make sure the snapshot builds for both branches build and had to go down a rabbit hole of other issues. Both 2.4 and 2.3.1 snapshots should be available for testing |
Tim te Beek commented Issue can be closed: Was fixed in spring-data-rest 2.3.1. Thanks a lot! |
Gennadii Kurbatov commented Problem again resume, but for PUT method: java.lang.IllegalArgumentException: Target bean is not of type of the persistent entity!
at org.springframework.util.Assert.isTrue(Assert.java:68) ~[spring-core-4.2.2.RELEASE.jar:4.2.2.RELEASE]
at org.springframework.data.mapping.model.BasicPersistentEntity.getPropertyAccessor(BasicPersistentEntity.java:394) ~[spring-data-commons-1.11.0.RELEASE.jar:na]
at org.springframework.data.rest.webmvc.support.ETag.getVersionInformation(ETag.java:191) ~[spring-data-rest-webmvc-2.4.0.RELEASE.jar:na]
at org.springframework.data.rest.webmvc.support.ETag.from(ETag.java:76) ~[spring-data-rest-webmvc-2.4.0.RELEASE.jar:na]
at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.prepareHeaders(AbstractRepositoryRestController.java:171) ~[spring-data-rest-webmvc-2.4.0.RELEASE.jar:na]
at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.prepareHeaders(AbstractRepositoryRestController.java:157) ~[spring-data-rest-webmvc-2.4.0.RELEASE.jar:na]
at org.springframework.data.rest.webmvc.RepositoryEntityController.saveAndReturn(RepositoryEntityController.java:495) ~[spring-data-rest-webmvc-2.4.0.RELEASE.jar:na] |
Gennadii Kurbatov commented Problem solved. We are use Backbone on frontend and for getting model apply projection. Therefore before save model must be this.model.unset("projection");
this.form.model.save(...); |
Andrew Walters commented Raised DATAREST-761 as a similar issue or possible regression |
Tim te Beek opened DATAREST-581 and commented
See the reference GitHub project.
I've got an
@Entity
with a@Version
'ed field, a@Projection
, and a Repository. When I try to GET the projection of a single entry, I get a 500 Internal server error, because of a failed assertion in BasicPersistentEntity line 394, as called from Etag line 191:The argument bean here is of type $Proxy90 / JdkDynamicAopProxy, not Book.
The projection only works again when the
@Version
annotation is removed. This is since Fowler, as I had no such issues with EvansAffects: 2.3 GA (Fowler)
Reference URL: https://github.com/timtebeek/etag-projection
Backported to: 2.3.1 (Fowler SR1)
The text was updated successfully, but these errors were encountered: