Suppose manager is an instance of a class whose job is to do CRUD (create, read, update, delete) operations on a Hibernate aware entity. Suppose we already have Keywords with keyword_id 243, 250, 260. Here's how we add a couple of keywords to another keyword as its children:
Keyword keyword1 = (Keyword)manager.getKeywordById(243); Keyword keyword2 = (Keyword)manager.getKeywordById(250); Keyword keyword3 = (Keyword)manager.getKeywordById(260); Set children=new HashSet(); children.add(keyword2); children.add(keyword3); keyword1.setChildren(children); manager.createOrUpdate(keyword1);With any luck you'll run the code without an error and see that the corresponding rows created in the database correctly. Congratulations! Questions? Let me know! Otherwise enjoying Java and Hibernate!
◀ Create Hibernate Configuration