Hibernate version: 3.1
Suppose we have a simple (legacy) table which mimics a map with column name, column value and a foreign key to a record in another table. e.g.
Code:
NAME_VALUE_TABLE
NAME VALUE KEY
text1 foo 1
text2 bar 1
text1 nother 2
text2 nbar 2
PERSON_TABLE
ID NAME FIRSTNAME
1 name1 firstname1
2 name2 firstname2
We could have a class Person like this:
Code:
public class Person {
....
public String getFirstname();
public String getName();
public String getText1();
public String getText2();
...
}
This means that the columns of person_table are mapped to the first two properties, and the other two name-value pairs are mapped to text1 and text2. You could say that this is the inverse of dynamic component, where columns are mapped to a map. Here you map map-entries to properties.
The arguments for this design are feasible for our purposes.
Is this possible using standard mapping, or do we have to use event-interceptor based methods?
James