嗨,這是我的表結構兩個表角色和組件。使用jpa創建一對多關係(MYSQL)
+----------------+
| role |
+----------------+
| role_id : PK |
| role_name |
| role_desc |
+----------------+
|
+----------------+
| component |
+----------------+
| comp_id : PK |
| role_id : FK |
| parent_comp |
| view_per |
| add_per |
| edit_per |
| delete_per |
+----------------+
這些bean類
package com.example.rolessample;
public class component {
private String comp_id;
private String role_id;
private String parent_comp;
private char view_per;
private char add_per;
private char edit_per;
private char delete_per;
}
package com.example.rolessample;
public class role {
private String role_id;
private String role_name;
private String role_desc;
}
什麼,我需要添加到我的bean類?
我已經看過在這個例子中,但我不知道如何將它應用到我的例子。
How do you to create a one to many relationship in JPA with no JoinTables?
在此先感謝。