-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: hbm generation no relationships just property -- HELP
PostPosted: Tue Dec 27, 2005 3:44 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 3:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
your jdbc driver or drivers is apparently not returning any foreign key constraints.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 28, 2005 11:18 am 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
Any idea why this might be? The db is INNODB, the db is enforcing the referential integrity. I've tried changing the db driver, tried running the reverse engineering as ant task (instead of through the eclipse plug-in) and still the tools are unable to determine the relationships.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 28, 2005 12:04 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2003 12:02 pm
Posts: 23
It was the driver. Please use mysql-connector-java-3.0.17-ga\mysql-connector-java-3.0.17-ga-bin.jar and the relationships will be found correctly.

Thanks for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.