I have 2 tables, named �items� and �item_types� (a lookup table), in which I�ve included the SQL DDL. I want to map them to a class defined below. I�ve included the mapping I�ve used which works great for querying the data. However, I�d like to save the data as well. I couldn�t figure out how to make Hibernate aware of the sequence in the item_types look-up table joined to my main table. I�m working with a legacy database and legacy class system, so I cannot easily create classes for each table.
I�d like to instantiate a class, assign a value to the classes types property and have it persist to the item table with the correct foreign key. Ideally, if a new �item_types.type� is added, it would get the next sequence value, insert the new type into item_types, and insert the new item with the correct foreign key for the new item type.
I assume I need to use the <join> tag, but I couldn�t figure out how to make it aware of my sequence.