Hibernate mapping help

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top