Results 1 to 3 of 3

Thread: ERROR: DBRE with multiple relationships between same tables

  1. #1
    Join Date
    May 2010
    Posts
    11

    Unhappy ERROR: DBRE with multiple relationships between same tables

    Hello,
    I have two tables(type and type_group) in database that have multiple relationships(one-to-many many-to-many) between each other:
    type --< type_group
    type >-< type_group (in reality modelled with intermediate table: type --< type_has_type_group >-- type_group)

    when I ran DBRE command from roo shell, I got output smth like that:
    Created ROOT\.roo-dbre
    ...
    Undo create ROOT\.roo-dbre
    Field 'typeGroups' already defined in ITD (ITD target 'sample.domain.Type_Roo_DbManaged)'

    I don't have column typeGroups in type table and I believe that the error message is caused by multiple relations between those tables. When I removed one-to-many relationship then DBRE worked.

    I don't know what would be the best solution for handling multiple relations between two tables (even if there is intermediate table between two of them in case of many-to-many relation), but I think this solution could be solved, if we could somehow specify the field names to be used that would be created into the model based on foreign-keys. One way place where this could be done is .roo-dbre file if RBRE add-on would be improved so conflicts such as this could be manually resolved. For example reference element in .roo-dbre file could have one more optional attribute (let's say "fieldName") that would be used for field name when creating field into *_Roo_DbManaged.aj file.

    Changes needed in the add-on for solution I described.
    If this situation is found while executing DBRE command, then
    1) .roo-dbre file would not be deleted to allow manually resolve same field name problem
    2) it would be create if .roo-dbre file would be amended with comment that points out places that need manual conflict resolution and adds "fieldName" attributes to reference element that should be filled manually by user before launching DBRE command again.
    3) add new option to "database reverse engineer" command that would force skipping inspection of DB and recreating .roo-dbre file, but instead uses manually edited file
    4) when running DBRE and creating reference fields into *_Roo_DbManaged.aj and reference element in .roo-dbre has fieldName attribute, then use it as a field name.

    If someone has better idea how to resolve this problem(other than removing foreign-key from the table and manually adding corresponding field into model) then share your ideas!

    BR,
    Ats

  2. #2
    Join Date
    Dec 2005
    Posts
    930

    Default

    I responded to the ticket - please provide your DDL
    Thanks
    Alan
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  3. #3
    Join Date
    Dec 2005
    Posts
    930

    Default

    Has already been fixed for the 1.1.1.RELEASE
    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
  •