I'm trying to figure out how to set up a one-to-many relationship on an Integer class. I have a User object that has a Set of "roles" which define the user's permissions, like this:
Code:
public class User {
Set roles;
}
The roles are just plain Integers, i.e. 1 = USER and 2 = ADMIN. I'm trying to set up a one-to-many relationship between the User and roles, like this:
Code:
<class name="BasicUser" table="users">
...
<set name="roles" table="user_roles">
<key column="user_id"/>
<one-to-many ???? />
</set>
</class>
However, I can't figure out what attributes I should put in the one-to-many tag. All of the examples I find for one-to-many use the "class" attribute, but it seems that would require a mapping for the Integer class to the USER_ROLES table. Is there a way I can tell one-to-many which column to look for without having to create a new class mapping?