I have a database schema that looks something like this:
Documents
doc_id
filecabinet_id
FileCabinet
filecabinet_id
table_name
num_fields
Example of file cabinet implementations
SchoolWork
fc_id
doc_id
attribute fields...
...
attribute fields
So. I can build the classes for the Documents and FileCabinet tables, but the other tables -- such as SchoolWork do not have a defined schema. The only thing they have in common is fc_id, and doc_id. The rest of the fields are attributes that only make sense for that file cabinet.
How do I model something like this when I only know the tables once I get the FileCabinet(s) back from the database and can read table_name from their column.
I have done this using my own framework using HashMaps to represent the attributes, but I am not sure how to do this in Hibernate. Any help would be most appreciated.
|