public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private BigInteger id;
private String name;
private String lastName;
@ManyToOne
@JoinColumn(name="subscription_id",nullable = false)
private Subscription subscription;
.
public class Subscription {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private BigInteger id;
private String type;
private double price;
private Date payDate;
@OneToMany(mappedBy = "subscription", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JsonIgnore
private List<User> users = new ArrayList<User>();
I have an user class with a relationship with the subscription class, I've ignored the user list at subscription level.
My problem comes when I'm trying to create a new endpoint to get the Subscription with the users that are part of that subscription,I just want to ignore the user list of the Subscription object in the User controller, is there a way to ignore at controller level? the @JsonIgnore seems to not work at that level. In the Subscription controller I need the Subscription list of users.
Regards.