Hi I need help about this scenario:
I've a bean User that have a List/Set of initiatives.
Initiative is a class that have 4 properties.
I have InitiativeA extends Initiative and InitiativeB extends Initiative.
Now, I need to populate the initiatives List of User but:
- InitiativeA and InitiativeB must not share the ID with Initiative, it will be indipendent (so discriminator can't help me).
- Initiative is only topologic table, InitiativeA and InitiativeB have foreign key to User.
Tables:
Code:
User:
------
ID
NAME
Initiative:
---------
ID
DESCRIPTION
InitiativeA:
-----------
ID
USER_ID
ADHESION (true/false)
InitiativeB:
-----------
ID
USER_ID
ADHESION (true/false)
Beans:
Code:
public class User{
private Integer id;
private String name;
private Set<Initiative> initiatives;
}
public class Initiative{
private Integer id;
private String description;
}
public class InitiativeA extends Initiative{
private Integer id;
private User user;
private Boolean adhesion;
}
public class InitiativeB extends Initiative{
private Integer id;
private User user;
private Boolean adhesion;
}
How can I map this into hbm files?
thanks a lot.