I have a very poorly modeled table which has the following columns:
string_a
string_b
and
string_c
string_a, string_b are the composite key to this table. There can be many string_c objects for one string_a + string_b key. I would like to be able to load the objects in this table into one objects for a given key with the properties:
stringA - String mapped to the string_a column
stringB - String mapped to the string_b column
stringCs - Collection mapped to the string_c column
For example, if I had the rows:
string_a = 'A'
string_b = 'B'
string_c = 'C'
and
string_a = 'A'
string_b = 'B'
string_c = 'D'
and
string_a = 'A'
string_b = 'B'
string_c = 'E'
loading by the composite_id key or selecting all the rows in the table would produce one object from these three rows of the form:
stringA = 'A'
stringB = 'B'
stringCs = Collection containing "C", "D", "E"
I know this is possible in IBatis. Is there a way to do it in Hibernate as well? (Without using any other table, because unfortunately there is no key table)
|