Hibernate version:3.2.6
Hi,
I have a database table EMP_TABLE like :
EMP_ID | KEY | VALUE
100 | EMP_NAME | John Scott
100 | CITY | NEW YORK
100 | COUNTRY | USA
240 | EMP_NAME | Shane Watt
240 | COUNTRY | CAN
300 | COUNTRY | USA
How should I write hibernate mappings for this table so that I can get the employee details & also save/update it, using following class ?
Code:
class Employee {
private int empId;
private String name;
private String city;
private String country;
.....getters & setters -----
}
Mapping :
Code:
<class name="Employee" table="EMP_TABLE">
<id name="empId" column="EMP_ID">
<generator class="assigned" />
</id>
<!-- Need help to get the city, country & name from the VALUE column using KEY column ---- ???????? ---- Please help -->
</class>
Any kind of clue, help is appreciated.
Code: