-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping a denormalized table with repeating columns
PostPosted: Thu Jun 18, 2009 11:45 am 
Newbie

Joined: Thu Jun 18, 2009 11:33 am
Posts: 1
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.