gpt4 book ai didi

java - JDL 导入解析成功,但生成的实体不匹配

转载 作者:行者123 更新时间:2023-11-30 07:45:40 26 4
gpt4 key购买 nike

当我导入 JDL 时,C:\temp\vdemo5>jhipster import-jdl room10.jh导入失败,我无法弄清楚原因。能否请你帮忙?其他导入也会发生此错误。

这是我的 JDL 文件 room10.hj:

entity Room {
name String,
occupancyLimit Int,
available Boolean
}

entity Reservation {
userId Long required,
title String
}

entity Building {
name String
}

entity Roomnotavaible {
startTime Instant,
endTime Instant
}

relationship ManyToOne {
Room{building(name)} to Building,
Reservation{room(name)} to Room,
Roomnotavaible{room(name)} to Room
}

paginate Room with infinite-scroll

====================================这是命令和错误:

C:\temp\vdemo5>jhipster import-jdl room10.jh
Using JHipster version installed locally in current project's node_modules
Executing jhipster:import-jdl room10.jh
Options:
The JDL is being parsed.
Found entities: Room, Roomnotavaible.
The JDL has been successfully parsed
Generating 2 entities.
Generating 2 entities.

Found the .jhipster/Room.json configuration file, entity can be automatically generated!


The entity Room is being updated.


Found the .jhipster/Roomnotavaible.json configuration file, entity can be automatically generated!


The entity Roomnotavaible is being updated.

events.js:183
throw er; // Unhandled 'error' event
^

Error: ERROR! Copying template src/test/java/package/web/rest/EntityResourceIntTest.java.ejs failed. [TypeError: C:\temp\vdemo5\node_modules\generator-jhipster\generators\entity-server\templates\src\test\java\package\web\rest\EntityResourceIntTest.java.ejs:230
228| private static final String <%=defaultValueName %> = "<%-sampleTextString %>";
229| private static final String <%=updatedValueName %> = "<%-updatedTextString %>";
>> 230| <%_ } else if (fieldType === 'Integer') { _%>
231|
232| private static final Integer <%=defaultValueName %> = <%= defaultValue %>;
233| private static final Integer <%=updatedValueName %> = <%= updatedValue %>;

Cannot read property 'replace' of undefined]
at Environment.error (C:\temp\vdemo5\node_modules\generator-jhipster\node_modules\yeoman-environment\lib\environment.js:157:40)
at module.exports.error (C:\temp\vdemo5\node_modules\generator-jhipster\generators\generator-base.js:1978:18)
at ejs.renderFile (C:\temp\vdemo5\node_modules\generator-jhipster\generators\utils.js:197:23)
at tryHandleCache (C:\temp\vdemo5\node_modules\ejs\lib\ejs.js:254:14)
at Object.exports.renderFile (C:\temp\vdemo5\node_modules\ejs\lib\ejs.js:482:10)
at Object.renderContent (C:\temp\vdemo5\node_modules\generator-jhipster\generators\utils.js:193:9)
at module.exports.template (C:\temp\vdemo5\node_modules\generator-jhipster\generators\generator-base-private.js:636:23)
at blockTemplate.templates.forEach (C:\temp\vdemo5\node_modules\generator-jhipster\generators\generator-base.js:2326:42)
at Array.forEach (<anonymous>)

====================================这是我的 .yo-rc.json

{
"generator-jhipster": {
"promptValues": {
"packageName": "com.variq.api",
"nativeLanguage": "en"
},
"jhipsterVersion": "5.0.2",
"applicationType": "gateway",
"baseName": "vdemo5",
"packageName": "com.variq.api",
"packageFolder": "com/variq/api",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Memory",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "a7f7bef8817ec82c2ca0ed3ecafc980346c42c81",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "yarn",
"testFrameworks": [
"protractor"
],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en",
"es"
]
}
}

最佳答案

这可能是你的 jdl 中的类型错误。尝试在您的 Room 实体中使用 Integer 而不是 Int

关于java - JDL 导入解析成功,但生成的实体不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51521599/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com