Results 1 to 4 of 4

Thread: DBRE: how avoid bidirectiona association?

  1. #1

    Question 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. #2
    Join Date
    Dec 2005
    Posts
    929

    Default

    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
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  3. #3

    Default

    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:



    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)

  4. #4
    Join Date
    Dec 2005
    Posts
    929

    Default

    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
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •