programing

Jhipster에서 JDL을 사용할 때 오류 발생

goodsources 2023. 1. 23. 10:12
반응형

Jhipster에서 JDL을 사용할 때 오류 발생

Jhipster에서 JDL을 사용할 때 문제가 있습니다.저는 JDL-Studio를 사용하여 엔티티를 설계합니다.이것은 jhipster-jdl입니다.jh 파일 생성 후:

    entity Member {
        fullName String required maxlength(100),
        birthDay LocalDate,
        address String maxlength(100),
        phone String maxlength(12),
        avatar String maxlength(100),
        aboutMe String maxlength(5000),
        systemStatus SystemStatus required,
        star Integer required
    }

    entity RealEstate {
        useFor UseFor required,
        location String maxlength(100),
        address String required maxlength(100),
        acreage Float required,
        price Float required, 
        currencyUnit CurrencyUnit required,
        typeRent TypeRent,
        status Status required,
        systemStatus SystemStatus required,
        description String maxlength(7000),
        star Integer required,
        numberBedRooms Integer,
        numberBathRooms Integer,
        avatar String maxlength(100)
        buildIn LocalDate,
        numberViews Integer required,
        createDate ZonedDateTime required
    }

    entity TypeRealEstate {
        name String required maxlength(50),
        number Integer required
    }

    entity Project {
        name String required maxlength(100),
        address String maxlength(100),
        location String maxlength(100),
        avatar String maxlength(100),
        price Float,
        description String maxlength(10000)
        tag String maxlength(200)
    }

    entity TypeProject {
        name String required maxlength(50)
        number String required
    }

    entity Coordinate {
        lat Float required,
        lnt Float required,
        type TypeCoordinate required
    }

    entity Bounds {

    }

    entity Question {
        content String required maxlength(1000)
        timeQuestion ZonedDateTime required,
        answer String required maxlength(1000),
        timeAnswer ZonedDateTime required,
        levelOfSatisfaction Float min(0) max(5)
    }

    entity Tag {
        name String required maxlength(50),
        number Integer required
    }


    entity Notification {
        content String required maxlength(100),
        typeNoti TypeNoti required
    }

    enum UseFor {
        SALE, RENT
    }

    enum CurrencyUnit {
        MILLION, BILLION
    }

    enum TypeRent {
        MONTH, YEAR
    }

    enum Status {
        AVAILABLE, NOT_AVAILABLE
    }

    enum SystemStatus {
        PENDING, APPROVED, NOT_APPROVE, LOCKED
    }

    enum TypeCoordinate {
        REAL_ESTATE, PROJECT, BOUNDS
    }

    enum TypeNoti {
        ANSWER, QUESTION, STAR
    }

    relationship OneToOne {
        Member{user} to User
    }


    relationship OneToMany {
        Member{realEstate} to RealEstate{poster}
    }

    relationship OneToMany {
        Project{realEstate} to RealEstate{project}
    }

    relationship OneToOne {
        Coordinate{project} to Project{coordinate}
    }

    relationship OneToOne {
        Coordinate{realEstate} to RealEstate{coordinate} 
    }

    relationship ManyToMany {
        Member{userStar} to User
    }

    relationship OneToMany {
        RealEstate{question} to Question
    }

    relationship OneToMany {
        Project{question} to Question
    }

    relationship OneToOne {
        Question{user} to User
    }

    relationship OneToOne {
        Bounds{southWest} to Coordinate
    }

    relationship OneToOne {
        Bounds{northEast} to Coordinate
    }

    relationship OneToOne {
        RealEstate{bounds} to Bounds
    }

    relationship OneToOne {
        Project{bounds} to Bounds
    }

    relationship ManyToOne {
        Notification{user} to User  
    }

    relationship OneToOne {
        Notification{question} to Question
    }

    relationship OneToOne {
        Notification{realEstate} to RealEstate
    }

    relationship OneToOne {
        Notification{project} to Project
    }

    relationship ManyToMany {
        RealEstate{userStar} to User
    }

    relationship ManyToMany {
        RealEstate{tag} to Tag{realEstate}  
    }

    relationship ManyToMany {
        Project{tag} to Tag{project}
    }

    relationship OneToMany {
        TypeRealEstate{realEstate} to RealEstate{type}
    }

    relationship OneToMany {
        TypeProject{project} to Project{type}
    }

    paginate RealEstate, Member, Project, Question, Notification with infinite-scroll

    dto * with mapstruct

그리고 명령어 yo를 사용합니다.jhipster:import-jdl jhipster-jdl.jh엔티티를 생성하면 정상적으로 실행됩니다.오류 없음.하지만 명령어를 사용하여 프로젝트를 실행하면./mvnw프로젝트를 실행할 수 없습니다.로그:

2016-10-27 09:18:31.099 ERROR 8835 --- [  restartedMain] o.h.hql.internal.ast.ErrorCounter        : line 1:17: unexpected token: member
2016-10-27 09:18:31.103 ERROR 8835 --- [  restartedMain] o.h.hql.internal.ast.ErrorCounter        : line 1:17: unexpected token: member

antlr.NoViableAltException: unexpected token: member
    at org.hibernate.hql.internal.antlr.HqlBaseParser.selectClause(HqlBaseParser.java:1343)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1062)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:731)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:323)
    at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:186)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:295)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
    at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:91)
    at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:109)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:304)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
    at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
    at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
    at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
    at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328)
    ... 53 common frames omitted

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28.009 s
[INFO] Finished at: 2016-10-27T09:18:32+07:00
[INFO] Final Memory: 65M/527M
[INFO] -----------------------------------------------------------------------

마리아답 쓰고 있어요.무슨 일인지 모르겠어요, 도와주세요!여러분 감사합니다

Maven 테스트를 실행하면 다음과 같이 표시됩니다.

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: member near line 1, column 17 [select distinct member from com.mycompany.myapp.domain.Member member left join fetch member.userStars]

이는 Member가 JPQL(MEMBER OF 식)의 예약어이기 때문입니다.

멤버 엔티티의 이름만 바꾸면 됩니다.

언급URL : https://stackoverflow.com/questions/40275667/error-when-use-jdl-in-jhipster

반응형