I try to create a link table for foreign key to which its primary key. My two keys must have the same name. Or is arrive get two keys with different names, or a key that is both primary and foreign key but that does not bear the name I want.
Code:
@ Entity
@ Table (name = "TASK")
public class Task implements Serializable {
@ Id
@ Column (name = "task_id", length = 36)
private String task_id;
@ OneToOne (mappedBy = "task", cascade = {CascadeType. ALL})
Private Barrage_JT barrageJT;
...
and in my other class I have:
Code:
@ Entity
@ Table (name = "BARRAGE_JT)
public class implements Serializable {Barrage_JT
@ Id
@ Column (name = "task_id")
private String task_id;
OneToOne @ (fetch = fetchType. EAGER)
private Task task;
...
in this case I find myself with a primary key and foreign key task_id TASK_TASK_ID, but if I change the name of the column in the class Barrage_JT, although I find myself with but a single column named TASK_TASK_ID. Or should my key apelle task_id.
Can you help me?
Bookmarks