Java – Jhipster did not create the entities I imported when I commanded jhipster

Jhipster did not create the entities I imported when I commanded jhipster… here is a solution to the problem.

Jhipster did not create the entities I imported when I commanded jhipster

I’ve used jhipster import-jdl my_file.jdl
Jhipster version V5.7.0

The contents of that jdl file are (below (IDK application?) The configuration does not show up in the code editor for stack overflow))

application {
    config {
        prodDatabaseType mysql
        buildTool maven
    }
}

entity Region {
    regionName String
}

entity Country {
    countryName String
}

 an ignored comment
/** not an ignored comment */
entity Location {
    streetAddress String,
    postalCode String,
    city String,
    stateProvince String
}

entity Department {
    departmentName String required
}

entity Task {
    title String,
    description String
}

entity Employee {
    firstName String,
    lastName String,
    email String,
    phoneNumber String,
    hireDate Instant,
    salary Long,
    commissionPct Long
}

entity Job {
    jobTitle String,
    minSalary Long,
    maxSalary Long
}

entity JobHistory {
    startDate Instant,
    endDate Instant,
    language Language
}

enum Language {
    FRENCH, ENGLISH, SPANISH
}

relationship OneToOne {
    Country{region} to Region
}

relationship OneToOne {
    Location{country} to Country
}

relationship OneToOne {
    Department{location} to Location
}

relationship ManyToMany {
    Job{task(title)} to Task{job}
}

relationship OneToMany {
    Employee{job} to Job,
    Department{employee} to Employee
}

relationship ManyToOne {
    Employee{manager} to Employee
}

relationship OneToOne {
    JobHistory{job} to Job,
    JobHistory{department} to Department,
    JobHistory{employee} to Employee
}

 Set pagination options
paginate JobHistory, Employee with infinite-scroll
paginate Job with pagination

 Use Data Transfert Objects (DTO)
 dto * with mapstruct

 Set service options to all except few
service all with serviceImpl except Employee, Job

 Set an angular suffix
 angularSuffix * with mySuffix`

and cmd display

DEBUG!  importState exportedEntities: 0
DEBUG!  importState exportedApplications: 1  
DEBUG!  importState exportedDeployments: 0
INFO! No change in entity configurations, no entities were updated.

When I don’t mention the app > configuration details, it gives an error

Error: The JDL object and the database type are both mandatory.        
ERROR! Error while parsing applications and entities from the JDL Error: The JDL object and the database type are both mandatory.

Can anyone tell me what I’m doing wrong?

Solution

You need to use entities * in the application configuration to assign entities to applications:

application {
    config {
        prodDatabaseType mysql
        buildTool maven
    }
    entities *
}
 your entities here

Related Problems and Solutions