I have a few tables in my database
User (userid, password roleid)
Role ( roleid, actionid)
Action ( actionid, action)
I need to join this three tables together,
base on the roleid from the user, i will get the roleid and from there do a one to many relation with Action.
I been reading on some of the examples online but all i could find is examples on joining 2 tables.
Is it possible to join all these three up using just one .hbm file?
You seem to have a many-to-many association:
many to many associations, as all the other kinds of associations, are described in the reference documentation:
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#assoc-unidirectional-join-m2m
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#assoc-bidirectional-join-m2m
I personally find annotations much more easy and developer-friendly than XML files. Consider using annotations rather than XML. Moreover, annotations are standard JPA annotations, and are the same for all the JPA implementations. They’re a good thing to know.