posted 6 years ago
Hello,
I have a question regarding how to retrieve records from a table that consists with one composite key.
In my hbm.cfg I have specified my composite key with this section:
<composite-id>
<key-property name="year"/>
<key-property name="month"/>
</composite-id>
I have a POJO class with all the "columns" that exists in my table.
How should I write this POJO class regarding to my composite key.
In the same package I hava a DAO class that retreives all records from the database.
How should I write a DAO method that retrieves all records from the table regarding to my composite key.
SQL query: select year,month,sallary from sallary where year>=2002
If I don't specify the composite key in my hbm.cfg hibernate retrieves too many records in my DAO object.
One record will be listed several times in the query result. Don't know why!