generator-jhipster: Importing .jh/JDL-Studio generated file results in error
Overview of the issue
I’m importing the following .jh file :
enum EventType {
DUNGEON_OPENED,
GOLD_CHANGED,
MONSTER_SPAWNED,
REALM_CLOSED
}
enum Server {
USWEST,
USEAST,
ASIASOUTHEAST,
USSOUTH,
USSOUTHWEST,
USEAST2,
USNORTHWEST,
ASIAEAST,
EUSOUTHWEST,
USSOUTH2,
EUNORTH2,
EUSOUTH,
USSOUTH3,
EUWEST2,
USMIDWEST,
EUWEST,
USEAST3,
USWEST3,
USMIDWEST2,
EUEAST,
AUSTRALIA,
EUNORTH,
USWEST2
}
entity EventData {
position Position,
eventType EventType,
player Player
}
entity Position {
mapName String,
server Server,
x Float,
y Float
}
relationship ManyToOne {
EventData{player} to Player
}
entity Player {
accountId Long
}
entity RealmSpyUser {
player Player required
}
relationship OneToOne {
RealmSpyUser{player} to Player
}
relationship OneToOne {
EventData{position} to Position
}
service all with serviceImpl
paginate EventData with infinite-scroll
And I’m getting
The jdl is being parsed.
warn: The method 'JDLParser::parse' is deprecated and will be removed in the next major release. Please use 'JDLParser::parseFromConfigurationObject' instead.
DEBUG! Error:
{ name: 'WrongTypeException',
message: 'The type \'GamePosition\' doesn\'t exist for mysql.',
prototype: Error
at new BuildException (E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\jhipster-core\lib\exceptions\exception_factory.js:59:25)
at getFields (E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\jhipster-core\lib\parser\jdl_parser.js:175:13)
at fillClassesAndFields (E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\jhipster-core\lib\parser\jdl_parser.js:135:15)
at parseFromConfigurationObject (E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\jhipster-core\lib\parser\jdl_parser.js:86:3)
at Object.parse [as convertToJDL] (E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\jhipster-core\lib\parser\jdl_parser.js:64:10)
at module.exports.parseJDL (E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\generator-jhipster\generators\import-jdl\index.js:89:47)
at Object.<anonymous> (E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\yeoman-generator\lib\index.js:399:25)
at E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\run-async\index.js:25:25
at new Promise (<anonymous>)
at E:\Files\Projects\RotMG\RotMG\RealmSpy\node_modules\run-async\index.js:24:19 }
WrongTypeException: The type 'GamePosition' doesn't exist for mysql.
events.js:183
throw er; // Unhandled 'error' event
^
Reproduce the error
The following command : jhipster import-jdl jhipster-jdl.jh --debug
JHipster Version(s)
v4.14.0
JHipster configuration
`Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
realmdata@0.0.0 E:\Files\Projects\RotMG\RotMG\RealmSpy
`-- (empty)
JHipster configuration, a .yo-rc.json file generated in the root folder
<details>
<summary>.yo-rc.json file</summary>
<pre>
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.realmspy"
},
"jhipsterVersion": "4.14.0",
"baseName": "realmdata",
"packageName": "com.realmspy",
"packageFolder": "com/realmspy",
"serverPort": "8080",
"authenticationType": "session",
"cacheProvider": "ehcache",
"enableHibernateCache": false,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Memory",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"enableSwaggerCodegen": false,
"rememberMeKey": "replaced-by-jhipster-info",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": false
}
}
</pre>
</details>
##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**
<details>
<summary>JDL entity definitions</summary>
<pre>
</pre>
</details>
##### **Environment and Tools**
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
git version 2.16.1.windows.1
node: v8.9.4
npm: 5.6.0
gulp:
[11:34:13] CLI version 2.0.1
yeoman: 2.0.1
yarn: 1.3.2
Docker version 17.12.0-ce, build c97c6d6
docker-compose version 1.18.0, build 8dd22a96
`
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 24 (13 by maintainers)
First of, the deprecation warning shouldn’t have been there, I’ll remove it… And you haven’t read the doc. The issue is that you have a field having a type named
Position, which is an entity. Composition/Aggregation is handled through relationships. Here you go:It looks like you didn’t start Zookeeper or Kafka but I can’t tell. Please keep in mind this is our issue tracker, not a question forum.
If you have a question please use Stack Overflow, and tag the question with jhipster. This helps the project to keep the issue tracker clean. Also, Stack Overflow will give your question a larger audience:
Another option is using our Gitter chat, for bigger questions StackOverflow can be better.
If you think you have an issue, please open a new one and fill out the template instead of commenting on an old/unrelated issue.
@iObsidian Your config shows
"websocket": false, you need to choose to enable websockets for the “tracker” example to show up. The prompt where the websocket choice is “Which other technologies would you like to use?”@ruddell this use case should be forbidden as it leads to invalid Java files. I’ll add an issue in JCore’s issue tracker to do it. @iObsidian the relationship should work the other way around (if not, there’s a regression in the generator).
thanks @ruddell for pushing this 😃