I have two MySQL tables: User (with an auto-incremented pk id) and WaitingUser which is a list of a subset of users. WaitingUsers table cannot contain more than one occurrence of a user so the column userId is PK.
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)
Now I would like to map but I don't know how to proceed.
The problem seems similar to the one reported here but I don't use annotation:
Using an Entity (and their Primary Key) as another Entity's Id
How can I define the PK of WaitingUser is the PK of User in the WaitingUser.xbm.xml file?