Say I have a Role type, which contains a long id, String name, etc. And I have another User class. Each user will have a roleId column which will point to Role.id.
In my database I will 2 tables, one for user, the other for role. The roleId in the user table will be a foreign key to role.id table.
My question is, how can I map this in Hibernate, so that I'll be able to have a Role role column in my User class, and would be able to do things like user.getRole().getName()?