You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's misleading and it has implications. For example in my use case it breaks repository sorting on any subsequent invocation with Spring Data Rest and Spring Data MongoDB. That's just for starters, for once a simple type 'leaks' there, it affects other operations.
That's for PUT:
Caused by: org.springframework.data.mapping.MappingException: Couldn't find PersistentEntity for type class java.lang.String!
at org.springframework.data.mapping.context.MappingContext.getRequiredPersistentEntity(MappingContext.java:76)
at org.springframework.data.mapping.context.PersistentEntities.lambda$getPersistentEntity$1(PersistentEntities.java:61)
at java.util.Optional.map(Optional.java:215)
at org.springframework.data.mapping.context.PersistentEntities.getPersistentEntity(PersistentEntities.java:61)
at org.springframework.data.rest.webmvc.json.DomainObjectReader.mergeForPut(DomainObjectReader.java:141)
at org.springframework.data.rest.webmvc.json.DomainObjectReader.lambda$mergeCollections$6(DomainObjectReader.java:460)
at java.util.Optional.map(Optional.java:215)
at org.springframework.data.rest.webmvc.json.DomainObjectReader.mergeCollections(DomainObjectReader.java:443)
at org.springframework.data.rest.webmvc.json.DomainObjectReader.access$200(DomainObjectReader.java:68)
at org.springframework.data.rest.webmvc.json.DomainObjectReader$MergingPropertyHandler.doWithPersistentProperty(DomainObjectReader.java:646)
at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:342)
at org.springframework.data.rest.webmvc.json.DomainObjectReader.lambda$mergeForPut$0(DomainObjectReader.java:145)
at java.util.Optional.map(Optional.java:215)
at org.springframework.data.rest.webmvc.json.DomainObjectReader.mergeForPut(DomainObjectReader.java:141)
at org.springframework.data.rest.webmvc.json.DomainObjectReader.readPut(DomainObjectReader.java:116)
I went with an a lot less invasive change to let ….hasPersistentEntity(…) properly consider the cached empty Optional. Staying with optional allows us to short circuit repeated attempts to create a PersistentEntity if we already have discovered the given source type to be unsuitable
Bartosz Kielczewski opened DATACMNS-1208 and commented
For any simple type, i.e. Date:
context.getPersistentEntity(Date::class.java) === null
context.hasPersistentEntityFor(Date::class.java) == true
Test case included.
I think it's misleading and it has implications. For example in my use case it breaks repository sorting on any subsequent invocation with Spring Data Rest and Spring Data MongoDB. That's just for starters, for once a simple type 'leaks' there, it affects other operations.
That's for PUT:
Affects: 2.0.1 (Kay SR1)
Reference URL: https://pastebin.com/V0qZigKK
Issue Links:
Referenced from: pull request #258, and commits d8cea8b, 875cb11
Backported to: 2.0.2 (Kay SR2)
The text was updated successfully, but these errors were encountered: