Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- public class Argument extends Model
- {
- @Id
- public Long id;
- @Required @NotEmpty @Size(max = 140)
- public String summary;
- @SuppressWarnings("unchecked")
- public static Finder<Long, Argument> find = new Finder(Long.class, Argument.class);
- ...
- }
- @Entity
- public class Relation extends Model
- {
- @Id
- public Long id;
- @Required @ManyToOne @NotNull @JsonManagedReference
- public Argument from;
- @ManyToOne @JsonManagedReference
- public Argument toArgument;
- @ManyToOne @JsonManagedReference
- public Relation toRelation;
- @Required @NotNull
- public Integer type;
- ...
- }
- [RuntimeException: java.lang.IllegalArgumentException: Infinite recursion
- (StackOverflowError) (through reference chain: models.Argument["relations"]->
- com.avaje.ebean.common.BeanList[0]->models.Relation["from"]->
- models.Argument["relations"]-> ... ->models.Argument["relations"])
- at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:611) ~[jackson-databind.jar:2.2.2]
- at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:142) ~[jackson-databind.jar:2.2.2]
- ...
- find.where().or(Expr.eq("from", argument), Expr.eq("toArgument", argument)).findList();
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "from") @JsonBackReference
- public List<Relation> fromThis;
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "toArgument") @JsonBackReference
- public List<Relation> toThis;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement