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

roo 1.2.2.RELEASE doesn't add relation tables in generated DOD

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Complete
    • Affects Version/s: 1.2.2.RELEASE
    • Fix Version/s: 1.2.3.RELEASE
    • Component/s: TESTING
    • Labels:
      None

      Description

      I'm using MySQL database with the following structure:

      Campaign table
      -- Campaign table
      
      CREATE  TABLE IF NOT EXISTS `campaign` (
        `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
        `provider_id` INT UNSIGNED NOT NULL ,
        `identifier` VARCHAR(255) NOT NULL ,
        `title` VARCHAR(255) NOT NULL ,
        `description` TEXT NULL ,
        `created_at` DATETIME NOT NULL ,
        `updated_at` DATETIME NOT NULL ,
        PRIMARY KEY (`id`) ,
        UNIQUE INDEX `identifier_UNIQUE` (`identifier` ASC) ,
        INDEX `fk_campaign_provider1` (`provider_id` ASC) ,
        CONSTRAINT `fk_campaign_provider1`
          FOREIGN KEY (`provider_id` )
          REFERENCES `provider` (`id` )
          ON DELETE NO ACTION
          ON UPDATE NO ACTION)
      ENGINE = InnoDB;
      
      Provider table
      -- Provider table
      
      CREATE  TABLE IF NOT EXISTS `provider` (
        `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
        `title` VARCHAR(255) NOT NULL ,
        `identifier` VARCHAR(255) NOT NULL ,
        `description` TEXT NULL ,
        `created_at` DATETIME NOT NULL ,
        `updated_at` DATETIME NOT NULL ,
        PRIMARY KEY (`id`) ,
        UNIQUE INDEX `identifier_UNIQUE` (`identifier` ASC) )
      ENGINE = InnoDB;
      
      • DBRE MySQL databas with roo 1.2.2.RELEASE (latest stable).

      I've ran DBRE feature with this command:

      database reverse engineer --schema no-schema-required --activeRecord false --package ~.domain --testAutomatically
      

      Result in CampaignDataOnDemand:

      CampaignDataOnDemand.java#getNewTransientCampaign
      public Campaign CampaignDataOnDemand.getNewTransientCampaign(int index) {
              Campaign obj = new Campaign();
              setCreatedAt(obj, index);
              setDescription(obj, index);
              setIdentifier(obj, index);
              setTitle(obj, index);
              setUpdatedAt(obj, index);
              return obj;
          }
      

      Field "providerId" is missing from generated code above. This cause failed tests.

      • DBRE MySQL databas with roo 1.2.1.RELEASE (previous stable).
        CampaignDataOnDemand.java#getNewTransientCampaign
        public Campaign CampaignDataOnDemand.getNewTransientCampaign(int index) {
                Campaign obj = new Campaign();
                setCreatedAt(obj, index);
                setDescription(obj, index);
                setIdentifier(obj, index);
                setTitle(obj, index);
                setProviderId(obj, index);
                setUpdatedAt(obj, index);
                return obj;
            }
        

      As you see here, provider_id field exists in this code.

      This issue cause impossible with spring roo 1.2.2.RELEASE monospaced}}perform test{{monospaced command to be executed successfully.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stewarta Alan Stewart
              Reporter:
              gogoluxecs Georgi Lambov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: