0

I have the class.

@Data
@Entity
@Table(name = "TRIPS")
public class Trip extends AbstractEntity {

    @Basic(optional = false)
    @Column(nullable = false)
    private boolean opened;

    @ToString.Exclude
    @JsonBackReference(value = "user_trips")
    @ManyToOne
    @JoinColumn(name = "user_id", nullable = false)
    private User user;
}

When I try to return info in JSON through Controller class, I get:

{
    "id": 8,
    "opened": true,
}

But I'd like to get User ID in my JSON. How can I do it? @JsonProperty doesn't work...

tt_531
  • 51
  • 5

0 Answers0