Skip to content
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

NestedEntitySerializer does not support Maps [DATAREST-864] #1234

Closed
spring-projects-issues opened this issue Aug 1, 2016 · 3 comments
Closed
Assignees
Labels
type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Aug 1, 2016

Petar Tahchiev opened DATAREST-864 and commented

With the latest Hopper-SR2 I get the following error:

2016-07-30 15:50:16,189 [main] WARN : Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write content: PersistentEntity must not be null! (through reference chain: org.springframework.data.rest.webmvc.json.["content"]->com.nemesis.platform.module.cms.core.entity.ListerPageEntity["title"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: PersistentEntity must not be null! (through reference chain: org.springframework.data.rest.webmvc.json.["content"]->com.nemesis.platform.module.cms.core.entity.ListerPageEntity["title"])

My entity has a Map<Locale, LocalizedValue> where LocalizedValue is @Embedable and in my case entity is null because in PersistentEntityJackson2Module you look it up like this

PersistentEntity<?, ?> entity = entities.getPersistentEntity(value.getClass());

but value is a Map so value.getClass() returns PersistentMap.

Sounds like you need a dedicated clause for Maps in NestedEntitySerializer.serialize(…).


Affects: 2.5.2 (Hopper SR2)

Referenced from: pull request #219

Backported to: 2.5.3 (Hopper SR3)

3 votes, 3 watchers

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Aug 5, 2016

Petar Tahchiev commented

Here's a very trivial pull-request. I've tested and it worked fine with it: #219

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Aug 22, 2016

Petar Tahchiev commented

Any updates here? I'm really hoping this could go into HopperSR3 :)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Aug 24, 2016

Falk Hartmann commented

I tried the changed PersistentEntityJackson2Module with Spring Data Hopper SR2 and it solved my serialization problem (a Map<Date, @Embeddable>) as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug
Projects
None yet
Development

No branches or pull requests

2 participants