I have main table merchants and second table terminals:
Merchant table:
@Entity
@Table
public class Merchants {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private int id;
@Column
private String name;
@Column
private String login;
}
Terminal table:
@Entity
@Table
public class Terminals {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id", updatable = false, nullable = false)
private int id;
@Column
private int merchant_id;
@Column
private String mode;
}
I want to set merchant_id into table Terminals. I suppose that many to many will be proper relation. How I can create it?