Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. @Entity
  2. public class Argument extends Model
  3. {
  4. @Id
  5. public Long id;
  6.  
  7. @Required @NotEmpty @Size(max = 140)
  8. public String summary;
  9.  
  10. @SuppressWarnings("unchecked")
  11. public static Finder<Long, Argument> find = new Finder(Long.class, Argument.class);
  12. ...
  13. }
  14.  
  15. @Entity
  16. public class Relation extends Model
  17. {
  18. @Id
  19. public Long id;
  20.  
  21. @Required @ManyToOne @NotNull @JsonManagedReference
  22. public Argument from;
  23. @ManyToOne @JsonManagedReference
  24. public Argument toArgument;
  25. @ManyToOne @JsonManagedReference
  26. public Relation toRelation;
  27. @Required @NotNull
  28. public Integer type;
  29. ...
  30. }
  31.  
  32. [RuntimeException: java.lang.IllegalArgumentException: Infinite recursion
  33. (StackOverflowError) (through reference chain: models.Argument["relations"]->
  34. com.avaje.ebean.common.BeanList[0]->models.Relation["from"]->
  35. models.Argument["relations"]-> ... ->models.Argument["relations"])
  36. at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:611) ~[jackson-databind.jar:2.2.2]
  37. at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:142) ~[jackson-databind.jar:2.2.2]
  38. ...
  39.  
  40. find.where().or(Expr.eq("from", argument), Expr.eq("toArgument", argument)).findList();
  41.  
  42. @OneToMany(fetch = FetchType.LAZY, mappedBy = "from") @JsonBackReference
  43. public List<Relation> fromThis;
  44. @OneToMany(fetch = FetchType.LAZY, mappedBy = "toArgument") @JsonBackReference
  45. public List<Relation> toThis;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement