This is driving me crazy -- I'm pretty sure that Hibernate can determine mapping relationships between tables and thus reflect this in the POJO's generated.
Except it's not.
I am using MySQL with STS & Hibernate Tools 4.0.0 and I have a one-to-many and a one-to-one table relationship, between Person <--> Phone and Phone <--> PhoneType and I am able to generate using the 'Hibernate Code Generation Configuration' the 'Domain Code' and the 'DAO Code', however neither of the files have any mappings between the tables.
Now here is a possible issue:
In order to get any annotations at all, I have switched on the option 'Generate EJB3 annotations'. Now I am using plain old Hibernate here, and not JPA.
So my questions are:
Thanks a lot for your help,
Bob
OK, I got it work at last!
The problem was, as with all things of a technical nature both simple and profound.
In a word: CaseSensitive
I had created my tables with capitaliZatioN (i.e. Person, Phone) and I used the MySQL Workbench to create the foreign keys and they looked like this:
CONSTRAINT FK_Phone_Person FOREIGN KEY (person_id) REFERENCES Person (person_id)
instead of
CONSTRAINT FK_Phone_Person FOREIGN KEY (person_id) REFERENCES person (person_id)
Notice the capitalization.
SOO happy after spending a lot of blood, sweat and tears trying to get that damn thing to work when all along the case was the problem!