Deepesh Uniyal
Deepesh Uniyal

Reputation: 991

Creating Entities using import-jdl

I am new in JHipster, creating my first project.

I create the .jdl file using the jdl-studio and now trying to import it using below command.

jhipster import-jdl initial-schema/initial-schema.jdl --debug

which is giving me below error, but the error not giving the specific error like an error with the relationship or creating table command.

Error:-

    Error: ERROR! Copying template /Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIntTest.java.ejs failed. [TypeError: /Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIntTest.java.ejs:262
    260|     private static final Long <%=defaultValueName %> = <%= defaultValue %>L;
    261|     private static final Long <%=updatedValueName %> = <%= updatedValue %>L;
 >> 262| <%_ } else if (fieldType === 'Float') { _%>
    263| 
    264|     private static final <%=fieldType %> <%=defaultValueName %> = <%= defaultValue %>F;
    265|     private static final <%=fieldType %> <%=updatedValueName %> = <%= updatedValue %>F;

Cannot read property 'replace' of undefined]
    at Environment.error (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/yeoman-environment/lib/environment.js:157:40)
    at module.exports.error (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base.js:1516:18)
    at ejs.renderFile (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/utils.js:207:23)
    at tryHandleCache (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/ejs/lib/ejs.js:254:14)
    at Object.exports.renderFile (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/ejs/lib/ejs.js:482:10)
    at Object.renderContent (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/utils.js:203:9)
    at module.exports.template (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base-private.js:672:23)
    at blockTemplate.templates.forEach.templateObj (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base.js:1936:42)
    at Array.forEach (<anonymous>)
    at module.exports.writeFilesToDisk (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/generator-jhipster/generators/generator-base.js:1898:45)
Emitted 'error' event at:
    at Immediate.setImmediate (/Users/deepeshuniyal/Desktop/upwork/employee-managment-system/node_modules/yeoman-generator/lib/index.js:427:22)
    at processImmediate (timers.js:637:19)

My .jdl file is here.

entity Currency {
    name String, 
    code String, 
    symbol String
}

entity Country {
    name String, 
    code Long, 
    flagImage BLOB
}
relationship OneToOne {
    Country{currency} to Currency
}

entity City{
    name String, 
    code String, 
    flagImage BLOB
}
relationship OneToMany {
    Country{city} to City
}

entity Company {
    name String, 
    code Long, 
    description String, 
    address String, 
    image BLOB
}
relationship OneToMany {
    Company{country} to Country
}


entity Employee {
    firstname String, lastname String, code Long, description String, address String, email String, 
landPhoneNumber String, mobilePhoneNumber String, image BLOB, fileUploadDirectory String
}

relationship ManyToOne {
    Employee{country} to Country,
    Employee{company} to Company
}

entity Role {
    name String, code Long, description String
}
relationship ManyToOne {
Employee{role} to Role
}

entity Appointment {
    name String, code Long, description String, address String, startDate LocalDate, endDate LocalDate
}
relationship OneToOne {
    Employee{employeeApointment} to Appointment
}

entity Group {
    name String, code Long, description String
}

relationship ManyToMany {
Group{employee} to Employee{group}
Employee{group} to Group{employee}
}



entity SubscriptionPack {
    name String, code Long, description String, price Double, renewPrice Double, period Double
}
relationship ManyToOne {
    SubscriptionPack{currenty} to Currency
}

entity EmployeeSubscription {
    subscriptionStart LocalDate, subscriptionEnd LocalDate
}
relationship OneToMany {
    Employee{employeeSubscription} to EmployeeSubscription
}
relationship ManyToOne {
    EmployeeSubscription{subscriptionPack} to SubscriptionPack
}

entity EmployeeSubscriptionInvoice {
    paymentDetailsAtts String
}
relationship OneToOne {
     EmployeeSubscription{employeeSubscriptionInvoice} to EmployeeSubscriptionInvoice
}

entity EmployeeSubscriptionInvoicePayment {
    paymentDetailsAtts String
}
relationship OneToOne {
    EmployeeSubscription{employeeSubscriptionInvoicePayment} to EmployeeSubscriptionInvoicePayment
}

entity EmployeeHolidays {
    name String, description String, startDate LocalDate, endDate LocalDate
}
relationship ManyToOne {
    Employee{employeeHolidays} to EmployeeHolidays
}


entity PublicHolidays {
    name String, description String, startDate LocalDate, endDate LocalDate
}


entity WorkPolicy {
    name String, description String, mondayStartTime LocalDate, mondayEndTime LocalDate, mondayBreakStartTime LocalDate, mondayBreakEndTime LocalDate, tuesdayStartTime LocalDate, tuesdayEndTime LocalDate, tuesdayBreakStartTime LocalDate, tuesdayBreakEndTime LocalDate, wednesdayStartTime LocalDate, wednesdayEndTime LocalDate, wednesdayBreakStartTime LocalDate, wednesdayBreakEndTime LocalDate, thursdayStartTime LocalDate, thursdayEndTime LocalDate, thursdayBreakStartTime LocalDate, thursdayBreakEndTime LocalDate, fridayStartTime LocalDate, fridayEndTime LocalDate, fridayBreakStartTime LocalDate, fridayBreakEndTime LocalDate, saturdayStartTime LocalDate, saturdayEndTime LocalDate, saturdayBreakStartTime LocalDate, saturdayBreakEndTime LocalDate, sundayStartTime LocalDate, sundayEndTime LocalDate, sundayBreakStartTime LocalDate, sundayBreakEndTime LocalDate
}


entity Report {
    name String, description String, createdOn LocalDate
}
relationship OneToMany {
    Employee{employeeReport} to Report
}

entity ReportQuestion {
    description String, createdOn LocalDate, dataType String, value String
}
relationship OneToMany {
    Report{reportQuestion} to ReportQuestion
}

entity ReportQuestionOption {
    description String
}
relationship OneToMany {
    ReportQuestion{reportQuestionOption} to ReportQuestionOption
}


entity EmployeeNotification  {
    byEmail Boolean, onDesktop Boolean, onEveryReport Boolean, onEveryAppointment Boolean, bySMS Boolean 
}
relationship OneToMany {
    Employee{employeeNotification} to EmployeeNotification
}

entity EmployeeDocuments {
    title String, description String, createdOn LocalDate
}
relationship OneToMany {
    Employee{employeeDocuments} to EmployeeDocuments
}

paginate all with pagination
dto * with mapstruct
service all with serviceImpl 

Upvotes: 0

Views: 844

Answers (1)

Ga&#235;l Marziou
Ga&#235;l Marziou

Reputation: 16284

Your JDL is wrong, BLOB should be spelled as Blob.

See official doc for types: https://www.jhipster.tech/jdl/#types_and_constraints

Also consider using Visual Studio Code with JHipster JDL extension to edit your JDL file, it will highlight errors like this one.

Upvotes: 1

Related Questions