I'm using hibernate in my new project and so far I love it :) I managed to map classes with collections etc, but now I'd like to persist this "configuration" class and I have no clue how to do this without declaring multiple tables. I'd like to have one "configuration" table with a key and value. The entire table should be loaded. Is this possible with hibernate?
Code:
public class Config
{
private Map values;
public Map getValues()
{
return values;
}
public void setValues(Map values)
{
this.values = values;
}
}
I've tried this:
Code:
<class name="Config" table="CLIENT_CONFIGURATION">
<id type="long" unsaved-value="0">
<column name="config_id" sql-type="number(8)" not-null="true"/>
<generator class="native"/>
</id>
<map name="values" table="CLIENT_CONFIGURATION" lazy="false">
<key column="config_id"/>
<index column="setting" type="string"/>
<element column="value" type="string"/>
</map>
</class>
but this requires a fk to a collection table which I do not have... Any suggestions?
Hibernate version:
2.18
Name and version of the database I'm using:
Oracle 9