Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
ceronj
22 Post subject: [Closed]generating one-to-one, many-to-one relationships  PostPosted: Mar 10, 2006 - 06:36 PM
Registered Member
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)? :?:
 
 View user's profile Send private message  
Reply with quote Back to top
support-snpe
Post subject:   PostPosted: Mar 10, 2006 - 06:59 PM
Moderator
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
 
 View user's profile Send private message  
Reply with quote Back to top
ceronj
Post subject:   PostPosted: Mar 10, 2006 - 07:18 PM
Registered Member
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.
 
 View user's profile Send private message  
Reply with quote Back to top
support-snpe
Post subject:   PostPosted: Mar 10, 2006 - 07:46 PM
Moderator
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
 
 View user's profile Send private message  
Reply with quote Back to top
Support-Brian
Post subject:   PostPosted: Mar 11, 2006 - 01:26 PM
Moderator
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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
ceronj
Post subject:   PostPosted: Mar 15, 2006 - 02:02 AM
Registered Member
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.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits