Announcement Announcement Module
Collapse
No announcement yet.
DBRE: how avoid bidirectiona association? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DBRE: how avoid bidirectiona association?

    Ok now I'm near to spamming.. :P
    How I avoid to generate bi-directional association?
    I have to generate only few entities for some tables.. One of this has many foreign keys pointing at his ID (call this table A). So in the dbre.xml generated it has many back reference to the other tables.
    If I give the option --includeTables with only the tables i need for this project, roo complains that can't generate entities for "A" because missing tables he reverence in his back mapping foreign keys. So I'm stuck to generate all the tables for the schema, and mantain all the the back reference in a reverence table accesse by many tables?
    Ex. you have a CITY table listing all the cities of a State. Many table uses this table with foreign keys to this with fields like BORN_CITY, ADDDRESS_CITY and so on..
    It's impractical to have a City entitiy with all the backreference to all this tables because only bi-directional generation is allowed.

  • #2
    How I avoid to generate bi-directional association?
    You can't at the moment. DBRE doesn't make assumptions as to what relationships to exclude. DBRE looks at a table's imported and exported keys via the JDBC API and creates the relationships. The same applies to the Eclipse feature of generating JPA entities from tables: if you select all the defaults, you will get bi-directional relationships (Roo does it better though).

    Alan

    Comment


    • #3
      If I use the vizard of Eclipse to generate JPA entities from Tables, I can select any number of tables of a schema and choose if generate a back association for every table in this dialog:

      http://www.forum-omondo.com/document...tive/img49.JPG

      Why have I to choose all the defaults if I don't need them?

      (...and it does not complain if a table has a foreign key pointing at it and you don't import the tables that reference it)

      Comment


      • #4
        Yes, I know, but Roo doesn't provide a GUI wizard for this, and I re-iterate, if you just click next, next etc finish in the Eclipse wizard you will get what DBRE gives you. However, the Eclipse feature doesn't handle tables with no primary keys defined

        Comment

        Working...
        X