Java data structure to use with Hibernate to store unknown number of parameters?

Posted by Lunikon on Stack Overflow See other posts from Stack Overflow or by Lunikon
Published on 2010-03-16T07:58:00Z Indexed on 2010/03/16 8:06 UTC
Read the original article Hit count: 226

Filed under:
|

Following problem: I want to render a news stream of short messages based on localized texts. In various places of these messages I have to insert parameters to "customize" them. I guess you know what I mean ;)

My question probably falls into the "Which is the best style to do it?" category: How would you store these parameters (they may be Strings and Numbers that need to be formatted according to Locale) in the database? I'm using Hibernate to do the ORM and I can think of the following solutions:

  • build a combined String and save it as such (ugly and hard to maintain I think)
  • do some kind of fancy normalization and and make every parameter a single row on the database (clean I guess, but a performance nightmare)
  • Put the params into an Array, Map or other Java data structure and save it in binary format (probably causes a lot of overhead size-wise)

I tend towards option #3 but I'm afraid that it might be to costly in terms of size in the database. What do you think?

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate