-->
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.  [ 1 post ] 
Author Message
 Post subject: No auto-generated relationships when reverse engineering
PostPosted: Fri Aug 24, 2012 6:17 am 
Newbie

Joined: Fri Aug 24, 2012 6:00 am
Posts: 1
Hi,

I just tried out Hibernate Tools and it seems to work just fine to reverse engineer my database scheme to a JPA model.
However, apparently, the tool does not generate any relationships for my DB scheme, even though some googling taught me that it should do that.

I'm only generating annotated classes based on all default settings (hibernate 4, reverse engineering from JDBC (mysql5 innodb), no reveng xml/strategy/custom templates, all default (4) checkboxes checked). I am however using combined primary keys that contain foreign keys. I already tried unchecking the "generate basic typed composite ids" option, but I think that option is only relevant when creating configuration files? (At least it takes no noticeable effect in the generated JPA entities.)


Example input:

Table "File" with an integer 'id' as PK.
Table "FileAnnex" with an integer 'file_id' and an integer 'annex_id' as combined PK. 'annex_id' is auto-generated. This table has a foreign key to the "File" table using the 'file_id' integer.


Output:

"File" class with 'id' integer.
"FileAnnex" class with FileAnnexId 'id' field.
"FileAnnexId" class with annexId and fileId integer fields.


Desired output:

"File" class with 'id' integer and a List<FileAnnex> field (the relationship).
"FileAnnex" class can remain as is.


Can anyone help me obtain the desired output?

Thanks in advance!

Best regards,
Wouter


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

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.