0
我有兩個MySQL表:用戶(具有自動遞增PK ID)和WaitingUser這是一個用戶子集的列表。 WaitingUsers表不能包含多於一個用戶,因此列userId是PK。休眠映射主鍵使用另一個類的ID
public class User implements Serializable{
private int id;
private String userName;
....
TABLE USER:
id int(10) unsigned PK
userName varchar(45)
public class WaitingUser implements Serializable{
private User userId;
private String otherinfo;
....
TABLE WAITING_USER:
userId int(10) unsigned PK
otherinfo varchar(45)
現在我想映射,但我不知道如何繼續。
這個問題似乎是一個類似於此報告,但我不使用註釋:
Using an Entity (and their Primary Key) as another Entity's Id
我如何定義WaitingUser的PK是用戶在WaitingUser.xbm.xml的PK文件?