Hibernate version:3.0 alpha
How do I tell Hibernate to join to a different table depending on a value in one column. I have two known tables and an unknown amount of extra tables that I will be linking to based on table name. Each unknown table contains different information for each filecabinet (but requires different amounts/types of columns). [This is also a legacy db schema so there is nothing I can do to change it.]
filecabinet
id
tbl_name
fields
filecabinet_id
fld_name
fld_type
I would like my filecabinet POJO to look like this:
class Filecabinet {
int getId(){}
string getTableName(){}
void setTableName(String x){}
Object getFieldValue(int row, String key) {}
void setFieldValue(int row, String key, Object o) {}
}
When the Filecabinet object gets loaded, I would like Hibernate to populate the an array of Map objects that corresponds to each row in the unknown table. Is this or anything like this possible and/or is this what dynamic-classes seek to fulfill.?
|