V
venu
I have two classes and two tables as shown below and I need help in
mapping them using hibernate,
class User
{
Long id;
String firstName;
String lastName;
UserDynAttributes dynAttributes;
}
class UserDynAttributes {
private Map attributes;
}
Table User ( id, firstName, lastName);
Table UserDynAttributes(id, the fields in this table are customizable)
The attributes member contains a map of column names and their values,
for example if the
attributes contains {(profession ->doctor), (country->XYZ)} I should
map them to table UserDynAttributes (id, profession, country).
Also, when I retrieve UserDynAttributes object from the database, it
should contain all the columns in the table mapped to java Map.
Has anyone done something like this in Hibernate?
Regards,
Venu
mapping them using hibernate,
class User
{
Long id;
String firstName;
String lastName;
UserDynAttributes dynAttributes;
}
class UserDynAttributes {
private Map attributes;
}
Table User ( id, firstName, lastName);
Table UserDynAttributes(id, the fields in this table are customizable)
The attributes member contains a map of column names and their values,
for example if the
attributes contains {(profession ->doctor), (country->XYZ)} I should
map them to table UserDynAttributes (id, profession, country).
Also, when I retrieve UserDynAttributes object from the database, it
should contain all the columns in the table mapped to java Map.
Has anyone done something like this in Hibernate?
Regards,
Venu