@JsonIgnore and @JsonBackReference are being Ignored

后端 未结 6 2123
感情败类
感情败类 2020-12-31 15:13

I\'m working with RestEasy, Jboss 7 and EJB 3.1. I\'m creating a RESTful web service that returns data in JSON format.

The problem is that I have a @ManyToOne<

6条回答
  •  独厮守ぢ
    2020-12-31 15:41

    Look, I have something similar to you and is working just fine for me...

    @JsonBackReference("promotion-travel")
    @ManyToOne(cascade = CascadeType.ALL)
        @JoinTable(name="PROMOTION_TRAVEL_REL",
            joinColumns = @JoinColumn(name="TRAVEL_ID"),
            inverseJoinColumns = @JoinColumn(name="PROMOTION_ID")
    )
    public Promotion getPromotion(){...
    

    And this is what I have on Entity1

    @JsonManagedReference("promotion-travel")
    @OneToMany(mappedBy="promotion")
    public List getTravelList(){...
    

    I don't know if moving the annotation to the top will change anything, but that's the only thing that I can see...

    Cheers,

提交回复
热议问题