|
I'm trying apply hibernate to an existing schema that looks like the following:
USER_ATTR: [user_id, attr_name, attr_value]
USER_ENT: [user_id, ent_value]
I need to use both of these tables together to create a User pojo what looks like:
class User {
List attributes;
List entitlements;
getId() {
// work through the attributes until the USER_ID attribute is found, then return the value...
}
}
The user pojo doesn't have a unique identifier as a member variable, but it is held as an attribute - hence the getId() method doing a lookup via the attributes list.
I can't seem to find any documentation on how I could apply hibernate in this situation - 'bags' seem to be right sort of thing, but I'm still not too sure if this is right.
I'd be grateful for any help or pointers in the right direction - please keep in mind that I'm unable to make changes to the db schema or the pojo.
Thanks
jv
|