I'm having problems with Jackson 1.6.3 and Hibernate. I found this thread here : Infinite Recursion with Jackson JSON and Hibernate JPA issue
But it did not solve the problem.
I have a Node object that has incoming and outgoing relations. Even with the @JsonManagedReference annotations, on the console of the app server I can see the exceptions being thrown (infinite recursion).
Is there any alternative to that?
@Entity
@Table(name="nodes")
public class Node implements Serializable {
@Id
private String id;
@Column(name="x_pos")
private double x;
@Column(name="y_pos")
private double y;
@OneToMany
@JoinColumn(name="source")
@JsonManagedReference("outgoingRelations")
private Set<Relation> outgoingRelations;
@OneToMany
@JoinColumn(name="target")
@JsonManagedReference("incomingRelations")
private Set<Relation> incomingRelations;
@Entity
@Table(name="relations")
public class Relation implements Serializable {
@Id
private Long id;
@ManyToOne
@JoinColumn(name="source")
@JsonBackReference("outgoingRelations")
private Node source;
@ManyToOne
@JoinColumn(name="target")
@JsonBackReference("incomingRelations")
private Node target;
Regards