facebook

[Closed]generating one-to-one, many-to-one relationships

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #248309 Reply

    ceronj
    Member

    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)? ❓

    #248313 Reply

    Haris Peco
    Member

    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

    #248317 Reply

    ceronj
    Member

    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.

    #248320 Reply

    Haris Peco
    Member

    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

    #248349 Reply

    Brian Fernandes
    Moderator

    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.

    #248591 Reply

    ceronj
    Member

    Sorry I didn’t get back. I fixed the problem. My schema was wrong. Works fine now.

    Thx for the help.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: [Closed]generating one-to-one, many-to-one relationships

You must be logged in to post in the forum log in