Generator-jhipster: Compilation errors with DTO, OAuth and ManyToMany with User

Created on 22 Jan 2020  ·  2Comments  ·  Source: jhipster/generator-jhipster

Overview of the issue

Compilation errors below:

[ERROR] /Users/theo/Documents/perso/jhipster-many/src/test/java/com/mycompany/myapp/service/mapper/CountryMapperTest.java:[20,45] incompatible types: java.lang.String cannot be converted to java.lang.Long
[ERROR] /Users/theo/Documents/perso/jhipster-many/src/test/java/com/mycompany/myapp/service/dto/CountryDTOTest.java:[14,53] incompatible types: java.lang.String cannot be converted to java.lang.Long
[ERROR] /Users/theo/Documents/perso/jhipster-many/src/test/java/com/mycompany/myapp/service/dto/CountryDTOTest.java:[19,53] incompatible types: java.lang.String cannot be converted to java.lang.Long
##### **Motivation for or Use Case** Project should compile. ##### **Reproduce the error** Generate the app using the JDL below:
JDL file
application {
  config {
    authenticationType oauth2
  }
  entities *
}

entity Country {
    name String
}

relationship ManyToMany {
    Country{User(login)} to User{Country(name)}
}

dto Country with mapstruct
##### **Related issues** ##### **Suggest a Fix** ##### **JHipster Version(s)**
[email protected] /Users/theo/Documents/perso/jhipster-many/mono
└── [email protected]

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
.yo-rc.json file
{
  "generator-jhipster": {
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "jhiPrefix": "jhi",
    "languages": ["en", "fr"],
    "messageBroker": false,
    "nativeLanguage": "en",
    "packageName": "com.mycompany.myapp",
    "packageFolder": "com/mycompany/myapp",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "serviceDiscoveryType": false,
    "skipClient": false,
    "skipServer": false,
    "testFrameworks": [],
    "websocket": false,
    "authenticationType": "oauth2",
    "jhipsterVersion": "6.6.0",
    "baseName": "jhipster",
    "buildTool": "maven",
    "skipUserManagement": true,
    "clientPackageManager": "npm",
    "applicationType": "monolith",
    "cacheProvider": "ehcache",
    "clientFramework": "angularX",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "serverPort": "8080",
    "useSass": true,
    "embeddableLaunchScript": false,
    "creationTimestamp": 1579723742179,
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "blueprints": []
  },
  "entities": ["Country"]
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions

entity Country {
  name String
}
relationship ManyToMany {
  Country{user(login)} to User
}

dto Country with mapstruct
service Country with serviceClass

Environment and Tools

openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.2+10)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.15.1, JRE 12 Mac OS X amd64-64-Bit Compressed References 20190915_201 (JIT enabled, AOT enabled)
OpenJ9 - 0f66c6431
OMR - ec782f26
JCL - 9984ea0dd9 based on jdk-12.0.2+10)

git version 2.25.0

node: v10.18.1

npm: 6.13.4

yarn: 1.21.1

Docker version 19.03.5, build 633a0ea

docker-compose version 1.24.1, build 4667896b

  • [x] Checking this box is mandatory (this is just to show you read everything)
$$ bug-bounty $$ $100 area OIDOAuth2

Most helpful comment

To any future good soul who'd try to fix this issue and drop a PR for this: there are already 2 of them, so please don't. Approve and/or challenge the existing PRs instead, communication is the key here.
Thanks :)

All 2 comments

Adding a bounty, as it seems to be a bug and needs to be fixed

To any future good soul who'd try to fix this issue and drop a PR for this: there are already 2 of them, so please don't. Approve and/or challenge the existing PRs instead, communication is the key here.
Thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahmedeldeeb25 picture ahmedeldeeb25  ·  3Comments

SudharakaP picture SudharakaP  ·  3Comments

pascalgrimaud picture pascalgrimaud  ·  3Comments

pascalgrimaud picture pascalgrimaud  ·  4Comments

tomj0101 picture tomj0101  ·  3Comments