• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

JSON parse error: Already had POJO for id

 
Ranch Hand
Posts: 447
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting this error in Angular for my Spring Boot project.  

JSON parse error: Already had POJO for id (java.lang.Long) [[ObjectId: key=5, type=com.fasterxml.jackson.databind.deser.impl.PropertyBasedObjectIdGenerator, scope=com.km.theatretix.entity.Venue]]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Already had POJO for id (java.lang.Long) [[ObjectId: key=5, type=com.fasterxml.jackson.databind.deser.impl.PropertyBasedObjectIdGenerator, scope=com.km.theatretix.entity.Venue]] (through reference chain: com.km.theatretix.entity.Ticket["theatreEvent"]->com.km.theatretix.entity.TheatreEvent["venue"]->com.km.theatretix.entity.Venue["id"])

However, it only happens on the first loop when I try to create a new ticket.   Here is the Angular function.  



Here is the Java code for the entity where the error is happening.  






 
Nathan Milota
Ranch Hand
Posts: 447
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It does it only for the first item in the seat table of the database.  Every other seat in the database works just fine.   It is just one seat that won't work right.  I don't get what's wrong.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you found a solution. Currently I'm facing the same problem...
 
Martin Keller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Honestly I've fixed it. Maybe the solution helps you or some other one.
This link Spring Custom Serializers with @JsonIdentityInfo helped me to figure out what possibly could help.

To explain my general conditions.

I had a circling relationship between objects:



Just had problems with the first entry as you've mentioned.
For me the solution was putting a "scope = Classname.class" additionally to every DTO class with the @JsonIdentityInfo. So it looked like this:


Maybe it helps someone who struggles with this issue too
 
reply
    Bookmark Topic Watch Topic
  • New Topic