например, у меня есть класс купонов, у меня есть класс клиентов, который я хочу использовать для клиентов идентификатор и идентификатор купона в третью таблицу.
У меня есть купоны:
Код: Выделить всё
@Entity
@Table(name = "coupons")
public class Coupon {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long coup_id;
private String title;
private String start;
private String end;
private int amount;
private String type;
private String message;
private double price;
private String image;
@ManyToMany(mappedBy = "coupons")
private List customers;

У меня есть клиенты:
Код: Выделить всё
@Entity
@Table(name="customers")
public class Customer {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int cust_id;
@Size(min=1,message="is required")
private String cust_name;
@Size(min = 1, message = "is required")
private String password;
@ManyToMany(cascade = { CascadeType.ALL })
@JoinTable(
name = "customer_coupon",
joinColumns = { @JoinColumn(name = "cust_id") },
inverseJoinColumns = { @JoinColumn(name = "coup_id") }
)
private List coupons;

и у меня есть соединительная таблица customer_coupon:
[img]https://i .sstatic.net/Xo5jS.png[/img]
Это ошибка, которую я получаю при запуске проекта:
Код: Выделить всё
Caused by: org.hibernate.DuplicateMappingException: Table [coupons] contains physical column name [coup_id] referred to by multiple physical column names: [coupId], [coup_id]
Подробнее здесь: https://stackoverflow.com/questions/576 ... lumn-names
Мобильная версия