This is my Product
entity class:
public class Product extends BaseEntity {
@Column
@ManyToMany()
private List<Customer> customers = new ArrayList<>();
@ManyToOne
private Supplier supplier;
}
And this is my Customer
entity class:
public class Customer extends BaseEntity {
//Enum type to String type in database '_'
@Enumerated(EnumType.STRING)
@Column
private Type type;
@Column
@ManyToMany(targetEntity = Product.class)
private List<Product> products = new ArrayList<>();
}
When I run my Spring boot project, it creates 2 separate tables in my database(Mysql): product_customer and customer_product but I need only one. What can I do to solve this?