Hibernate version 3.2.5
Database MySQL
I have a class with a composite-id (relation table), and i need to add some restrictions to the possilbe values. I'd like to know if there is any way to restrict it in mappig files (I prefer not to do it by code). The mapping file is:
Code:
<class name="CarOption" table="CAR_OPTION">
<composite-id name="pk" class="CarOptionPK">
<key-many-to-one name="modelOption" class="cars.ModelOption">
<column name="OPTION_ID" />
<column name="MODEL_ID" />
</key-many-to-one>
<key-many-to-one name="car" column="CAR_ID" class="cars.Car"/>
</composite-id>
<property name="value" column="VALUE" type="integer" not-null="false"/>
</class>
The restriction is that modelOption.pk.model, must equal car.model
Is there any way to add it in the mapping file?