Hi all,
my hibernate class Foo contains a many-to-one relation to the class Bar. I want an index on the column "bar_id". This does work with the following mapping:
Code:
<many-to-one foreign-key="foo_bar_fk" lazy="false" name="bar" class="Bar">
<column name="bar_id" index="foo_bar_id_i" not-null="true"/>
</many-to-one>
Now i want a unique key for my class Foo which also contains the "bar_id". This means i nest my many-to-one relation together with a property within a <properties> -tag:
Code:
<properties unique="true" name="foo_uk">
<many-to-one foreign-key="foo_bar_fk" lazy="false" name="bar" class="Bar">
<column name="bar_id" index="foo_bar_id_i" not-null="true"/>
</many-to-one>
<property name="code" not-null="true" length="50"/>
</properties>
Now my unique key is produced without a problem, but my index is gone. I'm using the SchemaExport of Hibernate. My database is Oracle 10.02.
Does anyone know a solution for this problem?
Thanks,
Chris