Im storing transactions in my application that consist of a sender and a receiver, this is my entity class for it:
@Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private User sender; private User receiver; private Item item; private LocalDateTime createdAt;
@Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private User sender; private User receiver; private Item item; private LocalDateTime createdAt;
what would be the best approach for the relationship here? create a oneToMany relationship with both sender and receiver? Or just store the IDs for sender and receiver instead of the User object?