• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Hibernate tool code generation org.hibernate.MappingException: Foreign key

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am working on some school project and have been trying to get my pojos, daos and mapping.xml documents generated.
I get some of my classes generated but others not.
When I select the option "Reverse Engineer from JDBC Connection" I get an Error Message:



I have been working with the Hibernate tools before and had no problems. Does anyone have an idea?

Thanks in advance.

I am using MySQL 5.1 with InnoDB. Here is my SQL:
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
from what I gather is that tResearch has a composite primary key and your only referencing a part of it in the foreign key in tStudent.
Try referencing the entire composite key of tResearch in your foreign key in tStudent
 
Sven Beckmann
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

but there are no composite keys in tReseach, just simple foreign key constraints.
 
Joe carco
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you sure? check your sql code, youre using composite PK's in almost all of youre tables:

(line 155)

some of the primary keys in your tables ARE foreign keys
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic