|
|
Load data with composite keys
I have a composite primary key mapping using the following tag :
lt;composite-id name=quot;advisorIDquot;gt;
lt;key-property name=quot;field_1quot;/gt;
lt;key-property name=quot;field_2quot;/gt;
lt;/composite-idgt;
Q1. I want to know, how will be the POJO for this : do we need a get/set method for quot;advisorIDquot;.What can be the signature of that ?
Q2.How do we use getHibernateTemplate().load() method which takes only 1 primary key ?
Please help...
Thanks.
You might want to take a look at the Hibernate reference manual that should answer your question.
hib_docs/v3...on-compositeid
Composite keys do not change things in the Java world, they just indicate that the object which serves as a PK it is mapped to not just one column but multiple columns (hence the term composite).
You can use the composite key just like a normal one but you have to pay attention to how it is mapped.
Heres an example that should help.
discuss...hread_id=22638 |
|