Hi Tatu,
Thank you very much for the response.
I will take a note of your comment and prepare a testable version.

Regards
Iftekhar

On Thu, 17 Nov 2022, 6:37 pm Tatu Saloranta, <t...@fasterxml.com> wrote:

> On Thu, Nov 17, 2022 at 9:32 AM Syed Iftekharuddin
> <eriftekhars...@gmail.com> wrote:
> >
> > Hi,
> > I have problem with Deserialization of entities with association.
> > The entities are as follows:
> >
> > @JsonIdentityInfo(generator =
> ObjectIdGenerators.PropertyGenerator.class, property = "id", scope =
> Process.class)
> > public class Process implements Serializable  {
> >
> >     // some properties here
> >     private UUID id;
> >
> >     private List<User> users = new ArrayList<>();
> >
> >     private List<ProcessHistory> processHistorySet = new ArrayList<>();
> >
> >     private List<AnsweredQuestionnaire> answeredQuestionnaires = new
> ArrayList<>();
> > }
> >
> > public class ProcessHistory implements Serializable {
> >     private UUID id;
> >
> >     @JsonIgnore
> >     private Process process;
> >
> >     private User user;
> > }
> >
> >
> > @JsonIdentityInfo(generator= ObjectIdGenerators.UUIDGenerator.class,
> property = "id", scope = AnsweredQuestionnaire.class)
> > public class AnsweredQuestionnaire implements Serializable {
> >
> >     private UUID id;
> >
> >     private Process process;
> > }
> >
> >
> > @JsonIdentityInfo(generator =
> ObjectIdGenerators.PropertyGenerator.class, property = "id", scope =
> User.class)
> > public class User implements Serializable {
> >
> >     private UUID id;
> >
> >     private List<Process> processes = new ArrayList<>();
> > }
> >
> > Using the entities with association will cause some problem during
> dserialization and cause the following error :
> >
> > com.fasterxml.jackson.databind.JsonMappingException: Already had POJO
> for id (java.util.UUID)
> > [[ObjectId: key=4c3cb331-bbbc-4105-bc3e-ddca3fea485d,
> type=com.fasterxml.jackson.databind.deser.impl.PropertyBasedObjectIdGenerator,
> scope=com.app.User]]
> > (through reference chain:
> com.app.User["processes"]->java.util.ArrayList[0]->com.app.Process["users"]->java.util.ArrayList[0]->
> com.app.User["id"])
> > java.lang.RuntimeException:
> com.fasterxml.jackson.databind.JsonMappingException: Already had POJO for
> id (java.util.UUID)
> > [[ObjectId: key=4c3cb331-bbbc-4105-bc3e-ddca3fea485d,
> type=com.fasterxml.jackson.databind.deser.impl.PropertyBasedObjectIdGenerator,
> scope=com.app.User]]
> > (through reference chain:
> com.app.User["processes"]->java.util.ArrayList[0]->com.app.Process["users"]->java.util.ArrayList[0]->
> com.app.User["id"])
>
> The most likely explanation would be that the same id was included for
> multiple User instances in incoming JSON.
>
> But other than that, a reproduction (ideally minimal unit test) would
> be needed to figure out if there is a real problem
> or if this is due to some configuration problem or such.
>
> -+ Tatu +-
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "jackson-user" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jackson-user/TfPCxDSD-Ac/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jackson-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jackson-user/CAL4a10gGPM%3Dg2obJ0aBEQzNOv%2BMSchDVHm2gNnEwBRshbxZZzg%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAFxswQLC5yXA8MmU8MBbnQ%2BwMzydPwkqz7reB1AYC8sBv-RmFw%40mail.gmail.com.

Reply via email to