Hi,
I'm new to hibernate and I've run into a problem trying switch over an old project to use hibernate. In this project we have a table named 'Config' which consists of two varchar rows 'Parameter' and 'Value'. The table simply stores a key and a value for various configuration properties. The problem is that within the system the table is not mapped as a collection of Config items, but instead it is mapped explicitly to properties, eg:
In the Table we have:
-------------------------
(PK) Parameter | Value
-------------------------
key1 | valueOfKey1
key2 | valueOfKey2
...
And in the POJO we have:
Code:
public class Config
{
private String key1, key2;
public String getKey1();
public void setKey1(String value);
public String getKey2();
public void setKey2(String value);
}
The values for the Parameter column
should never change. Is there anyway in Hibernate to map this?
I know a workaround whereby I map the rows as child elements inside a collection and then explicitly extract the values I need and assign them via the accessors, but I would rather avoid this if I have to in order to keep my data as dumb as possible.
Thanks in advance[/code]