k-dub wrote:
It would help by getting rid of the original problem - hundreds of int columns in one table. Which is the lesser of two evils - you decide. Given that the columns have an identical base name "Item" and only vary by a number at the end (kinda like a primary key), it seems like a one-to-many or many-to-many relationship would make more sense. Most database systems do relationships very well, hence the term "relational" in RDBMS. Is there a business domain reason against using relationships other than the perceived slowness?
You are absolutely right from a design standpoint, but unfortunately there's such thing as performance. A classical one-to-many solution results in multiple joins. As a result the performance degrade significantly.
I've been having the same problem and had to redesign my data model to use the same "Item1", "Item2"... layout to avoid those joins. At the moment I believe I reached a compromise by using one-to-many between the "master" record and "item pools" - records, containing 10 columns (Item1, Item2,...) each. This way it is more flexible, and I am not limited by say 100 columns.
Now, the hibernate aspect. For one, you can use <dynamic-component>. For me it didn't work as I'm using Hibernate annotations, which do not support it yet. So I ended up with creating a composite user type, which allows you to map your attribute to multiple columns. Works pretty well, and there's no significant drop in performance.