facebook

Join table reverse engineering not working

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

    jpantazes
    Member

    I am running MyElipse 5.1.0 GA. The database is Sybase, and the driver is the jConnect 5.5 jdbc 2 driver. I am trying to reverse engineer the current database to java code. The problem is that when hibernate completes the reverse I get classes that represent the join tables and not just the elements that I am expecting. Here is an example.

    PERSON
    ————
    aID
    name
    age

    CAR
    ———-
    bID
    make
    model

    PERSON_CARS_XREF
    ————————–
    aID
    bID
    date
    enabled

    I am expecting to see a Person class and a Car class and that a Person has a set of Cars. Instead what I get is a Person class that has a set of PersonCarsXref types. The PersonCarsXref types has a Set of Cars. The different thing to note is the 2 extra fields (date and enabled) within the PERSON_CARS_XREF table, these are maintained by the database and can be ignored. Any help is appreciated, thanks.

    #264686 Reply

    Brian Fernandes
    Moderator

    Hi,

    I initially thought you are asking for many to many support since normally a third table is only used to relate two entities if a many to many relationship exists between them (one person has many cars & one car can be owned/used by many persons). I’m not sure “one car, many owners/users” is what you want – is it? If it is, many to many support is coming in 5.5M1 which should be released in a couple of weeks.

    If you don’t really need a many to many relationship, I’m not sure I see the point of the separate PERSON_CARS_XREF table, you could put the date and enabled columns in the CAR table, and add “aID” as a foreign key which references aID in the PERSON table. Or is there some other constraint because of which you absolutely need the XREF table?

    Hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Join table reverse engineering not working

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