Relative Content

Tag Archive for javadatabasemany-to-many

Many To Many Relationship – coding conflicts

public class Invoice { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = “id”) private Long id; // Some fields … @ToString.Exclude @JsonIgnore @ManyToMany(fetch = FetchType.LAZY) @JoinTable( name = “invoice_elements”, joinColumns = @JoinColumn(name = “invoice_id”), inverseJoinColumns = @JoinColumn(name = “element_id”) ) private List<CostElements> costElements; } public class CostElements { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = “id”) private Long […]