Java – Jackson cannot be deserialized to foreigncollection (ormlite)

I have a problem deserializing nested JSON data I use ormlite to save data and spring / Jackson (2) combination to get data The collection / list of objects must be a foreigncollection interface before ormlite keeps it I have read several other stack overflow posts (1, 2, 3), but none has a clear solution

Here are some of my codes:

@ForeignCollectionField(eager = true)
@JsonProperty("images")
private ForeignCollection<Image> images;

I tried to add @ jsondeserialize (as = baseforeigncollection. Class) without any luck Changing foreigncollection to collection will make Jackson happy and parse the data, but then it will not be able to access the database

Any ideas?

Solution

Foreigncollection is an interface and cannot be serialized You should use the class that implements it, or just use @ jsonignore this field and add a regular list for serialization / deserialization purposes

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>