I am getting StackOverflow recursion error when I run query in Postman . Here is the model classes :
@Entity
public class UserWallet {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@NotNull
private String userName;
private String firstName;
private String lastName;
private String email;
@Temporal(TemporalType.DATE)
private Date createdDate;
@OneToMany(mappedBy = "userAccount", fetch = FetchType.EAGER)
private Set <Transaction> transactions = new HashSet<>();
Model class for Transaction:
@Entity
public class Transaction {
@Id
@GeneratedValue
private Long id;
private BigDecimal amount;
private java.util.Date transactionDate;
private Long transactionReference;
private String details;
@ManyToOne
private UserWallet userAccount;
When I run query on Postman it says :Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: java.util.ArrayList[0]->com.Wallet.Model.UserWallet[\"transactions\"])".