Amazon Now that we have database tables and Java class down, we have to tell Hibernate that we are doing self joins on Keyword. We can do this with XML configuration or Annotation. Here's the XML configuration. You can easily adapt it to Annotation if you are using Annotation. Questions?
We simply tell Hibernate that keyword_to_keyword has a column 'parent_id' that refers to another Keyword, joined by keyword_id column, as the parent. and it has a column 'child_id' that refers to another Keyword as the child. Since a keyword can have many parents and/or children this is a many-to-many mapping! Questions? Let me know!