• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Map a list/set/array to multiple columns in table

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to map similar type of columns to one property (or rather in a set or array)?

For Eg:

I have a denormalized table where I store individual tooth information in each column of the table say col_tooth1, col_tooth2, col_tooth3 ...col_tooth32 . Rather than having a one-to-one mapping of a column to a property in the persistent object, I would like to store all the information in an array of length 32.

Is it possible to do this kind of mapping in hibernate. Hibernate Sets/Lists represented multiple rows in a table. Can they be used to represent multiple similar types of columns instead of rows?
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but you are going to have to do the work.

Basically you can create your own UserType to do the transforming of the "32" colums into one Collection, and going the other direction when storing your data.

Please read http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mapping-types-custom

On custom usertypes.

Good Luck and have fun.

Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic