Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2 sp1
Mapping documents:
Test1.hbm.xml :
Code:
<class name="Test1" table="test1">
<comment></comment>
<id name="a" type="int">
<column name="a" />
<generator class="assigned" />
</id>
<property name="b" type="string">
<column name="b" length="5" not-null="true" />
</property>
<set name="test2s" inverse="true">
<key>
<column name="a" not-null="true" unique="true" />
</key>
<one-to-many class="Test2" />
</set>
</class>
Test2.hbm.xml :Code:
<class name="Test2" table="test2">
<comment></comment>
<id name="a" type="int">
<column name="a" />
<generator class="assigned" />
</id>
<many-to-one name="test1" class="Test1" update="false" insert="false" fetch="select">
<column name="a" not-null="true" unique="true" />
</many-to-one>
<property name="c" type="string">
<column name="c" length="5" not-null="true" />
</property>
</class>
Name and version of the database you are using:MySQL 5.0.37
Hello,
when I use the schema export with hibernate tools, the test2 tables has 3 keys on the a column : a PRIMARY KEY, a simple KEY, and a FOREIGN KEY.
It is clear that the simple KEY is useless. Is there any way to avoid the creation of this KEY ??
thanks !