We're using Hibernate 2.1.7c with Firebird 1.5.2.
We have two objects, Solution and Service, each of which has a Map of ConfigSetting.
Initially we set it up such that both Solution and Service have a Map like this:
Quote:
<map name="configSettings"
table="CONFIGESETTING"
lazy="false"
inverse="false"
cascade="save-update">
<key column="service_id"/>
<index column="NAME" type="java.lang.String"/>
<one-to-many class="com.lexmark.workflow.framework.domain.configsetting.ConfigSettingImpl"/>
</map>
This resulted in two foreign key constraints being created, one from ConfigSetting to the ID column of Service, and another from ConfigSetting to the ID column of Solution. We got constraint violations because both foreign keys are never set - the ConfigSetting either goes with a Solution, or with a Service, so one of the foreign keys is always null.
I've been playing around with this and saw something about making the map one-to-many with inverse="true". This may have helped, since now the ConfigSetting just contains two columns, one for the id of the Service and another for the id of the Solution. But our testcases are failing and I'm not sure when I look in the database that the IDs are matching up.
I thought I would take a step back and ask someone how THEY would set this up. A good example of a similar set of objects would be very helpful.
-Jeff