Hi-
I'm dealing with a table that, for performance reasons has been denormalized as following: -there are about 5 columns which uniquely define a row (things like age, income zip, etc). There's also a surrogate id. -there are 50 "sets" of columns each of wich have the same set of data. For example: id, gender_id, age_id, income_id, zip_id category1_name, category1_id, category_data1, category1_data2, category2_name, etc ,etc.
-I'd like one row of this table to map a Results class, that contains the gender, age, income ,etc and a list of categories. But, in this case the categories aren't rows in a table, they're repeating sets of columns in the same table. -One approach would be to create a class w/ all those columns, let hibernate map to that and then create functions in the class to create the list using reflection -But, my thought is that given that hibernate is a powerful, flexible ORM tool, it should be able to handle this case (however wacky it may be)...Perhaps through some use of composite elemetns, formulas or custom code. I could certainly write a SQL statement that would generate a list of the category columns, but can't figure how i'd tell hibernate to "loop" and create a composite element for each iteration of the loop. I'd be up for writing a custom class to plug into hibernate; but am not sure what type of class id' need to write and where it would plug in. -I also have a table which holds a list of categories (and ids for them)--and could potentially use this if it helped.
I've been doing lots of research, but haven't come across anything yet.
Any ideas? Thanks...
|