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
|