Need help with @JsonManagedReference and @JsonBackReference
I was getting a Multiple back-reference properties with name 'defaultReference' error for my entities so I implemented ("cartitem-excursions") which fixed the issue but created these new ones. I cant figure out what I'm doing wrong can someone help me setting up my @JsonManagedReference and @JsonBackReference for entities.
Entities: https://pastebin.com/p4LCFER8
Errors:
2024-10-18T21:23:27.202-07:00 WARN 20716 --- [nio-8080-exec-5] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class com.assessment.entities.Customers]]: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot handle managed/back reference 'cartitem-excursions': back reference type (java.util.Set<com.assessment.entities.CartItems>) not compatible with managed type (com.assessment.entities.CartItems)
2024-10-18T21:23:27.228-07:00 WARN 20716 --- [nio-8080-exec-5] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class com.assessment.entities.Customers]]: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot handle managed/back reference 'cartitem-excursions': back reference type (java.util.Set<com.assessment.entities.CartItems>) not compatible with managed type (com.assessment.entities.CartItems)
Pastebin
package com.assessment.entities;import jakarta.persistence.*;import...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
3 Replies
⌛
This post has been reserved for your question.
Hey @kry0_0.! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
Stack Overflow
Can not handle managed/back reference 'defaultReference': back refe...
Forum Answer saving time facing issue.before i saved successfully using @JsonIgnore but now i removed @JsonIgnore annonation.and added @JsonBackReference and @JsonManagedReference.
Stack Trace
...
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.