This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I don't know if the subject of the post is relevant, but here is my problem: (taken from the hibernate reference book)
I have a Person with id, age, firstname, lastname, and a set of email addresses. The addreses are stored in a different table (id, email). In this case, the primary key for this new table should be both id and email. So, how do I create this new table with hibernate that has a composite key, because in the way described in the reference manual is not working (none of the fields are marked primary key)
in the Person.hbm.xml file I have written: <set name="emailAddresses" table="PERSON_EMAIL_ADDR"> <key column="PERSON_ID"/> <element type="string" column="EMAIL_ADDR" /> </set>