Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3144

MySql unique indexed ignored on foreign key columns by reverse engineering with generated integration tests failing

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Works as Designed
    • Affects Version/s: 1.2.1.RELEASE
    • Fix Version/s: None
    • Component/s: @ CORE, PERSISTENCE
    • Labels:
    • Environment:
      Linux Mint 12
      java version "1.6.0_29"
      Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
      Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)

      Description

      If a column has the unique index and the column is also a foreign key, then the unique index feature of the column seems ignored by the reverse engineering process.

      To replicate the issue simply create a MySql database containing two tables, one having a foreign key constraint on the other, like:

      create table if not exists user ( id int unsigned not null auto_increment, version int unsigned not null, name varchar(20), primary key (id), unique (id) ) type = INNODB;

      create table if not exists teacher ( id int unsigned not null auto_increment, version int unsigned not null, admin_id int unsigned not null, user_id int unsigned not null, index(admin_id), unique(admin_id), index (user_id), foreign key (user_id) references user(id), unique (user_id), primary key (id), unique (id) ) type = INNODB;

      Then open the roo.sh shell and type in the following commands:

      project --topLevelPackage com.learnintouch.jira --java 6 --packaging jar
      jpa setup --provider HIBERNATE --database MYSQL
      database properties set --key database.username --value myuser
      database properties set --key database.password --value mypassword
      database properties set --key database.url --value jdbc:mysql://localhost:3306/roo_jira
      database properties list
      database introspect --schema roo_jira
      database reverse engineer --package ~.domain --schema roo_jira --testAutomatically --includeNonPortableAttributes
      perform tests

        Attachments

          Activity

            People

            • Assignee:
              stewarta Alan Stewart
              Reporter:
              stephaneeybert Stephane
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: