I've have issues deserializing nested json data. I am using Ormlite to persist the data and a combination of Spring/Jackson(2) to fetch the data. Collections/lists of objects must be of the ForeignCollection
interface before Ormlite will persist it. I've read several other Stackoverflow posts (1, 2, 3), but non of them has a clear solution.
Here is some of my code:
@ForeignCollectionField(eager = true)
@JsonProperty("images")
private ForeignCollection<Image> images;
I've tried adding @JsonDeserialize(as=BaseForeignCollection.class)
without any luck. Changing ForeignCollection
to Collection
will make Jackson happy and parse the data, but then it won't hit the database.
Any ideas?