I am attempting to reverse engineer an existing mysql db through the eclipse plug-in. Everything works correctly but the resulting .hbm files contain no relationships. i would expect a many-to-one relationship to be autogenerated for me. Instead the tool simple see's it as another property. Everything is mapped as a simple property. Am I doing something wrong?
How do I get the tool to see the FK relationships and generate one-to-many and many-to-one etc. mapping files?
Mapping documents:
Code:
<hibernate-mapping>
<class name="reservatio.Reservationvenue" table="reservationvenue">
<id name="idReservationVenue" type="integer">
<column name="idReservationVenue" />
<generator class="assigned" />
</id>
</class>
</hibernate-mapping>
Code:
<hibernate-mapping>
<class name="reservatio.Reservationitem" table="reservationitem">
<id name="idReservationItems" type="integer">
<column name="idReservationItems" />
<generator class="assigned" />
</id>
[b]This should have been reversed engineered as a many-to-one but instead it's recognizing it as a property[/b]
<property name="idReservationVenue" type="integer">
<column name="idReservationVenue" not-null="true" unique="true" />
</property>
</class>
</hibernate-mapping>
CREATE TABLE ReservationVenue (
idReservationVenue INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY(idReservationVenue),
)
TYPE=InnoDB;
CREATE TABLE ReservationItem (
idReservationItems INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
idReservationVenue INTEGER UNSIGNED NOT NULL,
PRIMARY KEY(idReservationItems),
INDEX ReservationItem_FKIndex1(idReservationVenue),
FOREIGN KEY(idReservationVenue)
REFERENCES ReservationVenue(idReservationVenue)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
TYPE=InnoDB;
Hibernate version:
HibernateTools-3.1.0.beta2.zip Eclipse plugin