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
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @kry0_0.! Please use /close or the Close 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.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st2mo ago
I think you need @JsonIdentityInfo: https://stackoverflow.com/a/44714439/10871900
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 ...
JavaBot
JavaBot2mo ago
💤 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.
Want results from more Discord servers?
Add your server