jhipster / jhipster-core

JHipster Domain Language, used by JHipster UML and JDL-Studio to generate entities
Apache License 2.0
345 stars 116 forks source link

Exporting JDL that has a MapsId relation misses the 'with jpaDerivedIdentifier' directive #319

Closed Gabrui closed 5 years ago

Gabrui commented 5 years ago
Overview of the issue

The JDL regenerated through the jhipster info or through the jhipster export-jdl doesn't come with the 'jpaDerivedIdentifier' directive.

Motivation for or Use Case

I was reporting a bug to the jhipster-generator and found this problem. It may cause problems for people that try to regenerate the project through this JDL.

Reproduce the error

Created a new project, imported the JDL, exported the JDL.

Related issues

This feature was implemented in the #294

Suggest a Fix

The MyEntityUserExtra.json in the .jhipster folder has the relation with "useJPADerivedIdentifier": true, so I think it is just a missing feature in the export.

JHipster Version(s)

6.0.0-beta.0 (but the test error also happens on the 5.8.2, the Liquibase error is new)

jh-3-teste@0.0.0 /home/gabriel/Projetos/jh3teste
└── generator-jhipster@6.0.0-beta.0 
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "org.learn.testing",
      "nativeLanguage": "pt-br"
    },
    "jhipsterVersion": "6.0.0-beta.0",
    "applicationType": "monolith",
    "baseName": "jh3teste",
    "packageName": "org.learn.testing",
    "packageFolder": "org/learn/testing",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": "elasticsearch",
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "clientFramework": "angularX",
    "clientTheme": "materia",
    "clientThemeVariant": "primary",
    "useSass": true,
    "clientPackageManager": "yarn",
    "testFrameworks": ["protractor"],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "pt-br",
    "languages": ["pt-br", "en", "es"]
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity MyEntityOne {
  name String required unique,
  value Integer required
}
entity MyEntityUserExtra {
  name String required unique,
  departure LocalDate required
}
entity MyEntityThree {
  name String required unique,
  desc String required
}
entity MyEntityComplex {
  name String required unique,
  desc String required
}
relationship OneToOne {
  MyEntityUserExtra{user(login)} to User with jpaDerivedIdentifier
}
relationship ManyToOne {
  MyEntityUserExtra{myEntityThree(name) required} to MyEntityThree,
  MyEntityComplex{myEntityOne(name) required} to MyEntityOne,
  MyEntityComplex{myEntityUserExtra(name) required} to MyEntityUserExtra
}

paginate MyEntityOne, MyEntityUserExtra, MyEntityThree, MyEntityComplex with pagination
service MyEntityOne, MyEntityUserExtra, MyEntityThree, MyEntityComplex with serviceImpl
filter MyEntityOne, MyEntityUserExtra, MyEntityThree, MyEntityComplex

Environment and Tools

openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment 18.9 (build 11.0.2+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

git version 2.11.0

node: v10.15.3

npm: 6.4.1

yeoman: 2.0.5

yarn: 1.15.2

Docker version 18.09.5, build e8ff056dbc

docker-compose version 1.24.0, build 0aa59064

Browsers and Operating System

Using Debian 9.8. Generated the project with --yarn.

MathieuAA commented 5 years ago

Roger that. Thanks for reporting this, I'll try to reproduce this tonight.