| Author |
Message |
|
|
|
Post subject: [Closed]generating one-to-one, many-to-one relationships
Posted: Mar 10, 2006 - 06:36 PM
|
|
Registered Member


Joined: Feb 01, 2006
Posts: 16
|
|
How do I generate the mapping files for two tables that have a one to many or a one to one relationship (i.e., user_account table and address table)? :?: |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 10, 2006 - 06:59 PM
|
|
Moderator


Joined: Feb 03, 2006
Posts: 1117
|
|
ceronj,
Select tables in Db Browser, right click and call 'Generate Hibernate wizard' - follow wizard and you will have mapping with correct relations (your tables have to have PK and FK)
Best |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 10, 2006 - 07:18 PM
|
|
Registered Member


Joined: Feb 01, 2006
Posts: 16
|
|
Tried that and it didn't work. What do you mean by PK? Primary Key? I setup the user_account table with an identity Id primary and the address table with the user_account.id as a foreign key. The I changed it and made the user_account.id the primary key in the address table. None of this worked. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 10, 2006 - 07:46 PM
|
|
Moderator


Joined: Feb 03, 2006
Posts: 1117
|
|
Hi,
Send us example of your database schema (create command)
PK - primary key
FK - foreign key
In reverse engineering we can make relation for objects in databases (tables, columns, primary keys,foreign keys)
only
What is your version database, eclipse and MyEclipse ?
Best |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 11, 2006 - 01:26 PM
|
|
Moderator


Joined: Aug 21, 2004
Posts: 2281
|
|
Ceronj,
As snpe stated above, If there is a relationship expressed in the database model, we will pick it up. Make sure you select both tables before invoking reverse engineering.
Also, could you please qualify what you mean by "didn't work". Are any files being generated at all? Are the files being generated but missing the relationships or you see an error and nothing is generated?
If you are using a version of MyEclipse prior to 4.1.1, on Page 2 of the RE wizard -make sure "generate basic typed composite ids" is checked. I would suggest upgrading to 4.1.1 for a better experience.
Please answer all the questions here: Posting Guidelines to help us resolve your issue quickly.
Best,
Brian. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 15, 2006 - 02:02 AM
|
|
Registered Member


Joined: Feb 01, 2006
Posts: 16
|
|
Sorry I didn't get back. I fixed the problem. My schema was wrong. Works fine now.
Thx for the help. |
|
|
| |
|
|
|
 |
|
|