Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Frameworks
Search Coderanch
Advance search
Google search
Register / Login
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
Paul Clapham
Ron McLeod
Jeanne Boyarsky
Tim Cooke
Sheriffs:
Liutauras Vilda
paul wheaton
Henry Wong
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Carey Brown
Frits Walraven
Bartenders:
Piet Souris
Himai Minh
Forum:
Other Application Frameworks
HttpMessageNotWritableException: Could not write JSON: Infinite recursion
Girish Velivela
Greenhorn
Posts: 16
posted 6 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I am Feed up in findings solution for 'Infinite recursion' in preparation of the json of Hibernate entities. I tried every possible of solution:
public class Question implements Serializable{ @OneToMany(mappedBy = "question", fetch = FetchType.EAGER, cascade = CascadeType.ALL) @Column(nullable = true) private Set<QuestionOption> options = new HashSet<QuestionOption>(); public class QuestionOption implements Serializable{ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="question_id", referencedColumnName = "question_id") @JsonIgnore private Question question;
Another thing I tried is
public class Question implements Serializable{ @OneToMany(mappedBy = "question", fetch = FetchType.EAGER, cascade = CascadeType.ALL) @Column(nullable = true) @JsonManagedReference private Set<QuestionOption> options = new HashSet<QuestionOption>(); public class QuestionOption implements Serializable{ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="question_id", referencedColumnName = "question_id") @JsonBackReference private Question question;
I am using spring 4.0 and hibernate 4.3 .
Advance thanks thanks thanks thanks for help..............
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Deleted records while merging
Edit primary key, if it's a foreign key
Outer join between 3 entities in HQL
deleting causes : not-null property references a null or transient value
what us mean mappedBy="item" ?
More...