我刚来这地方。我正在尝试使用JHispter创建一个新的应用程序。

我已经使用“ yo jhipster”命令来生成应用程序。

我已经使用JDL Studio开发了实体,但是,当我将JDL与“ yo jhipster:import-jdl model.jdl”一起使用时,出现了一个错误-但是错误消息不提供有关导致错误的原因的任何线索。

我看到的错误消息和JDL文件的内容如下。请让我知道我该如何调试。请注意,我是jhipster和StackOverflow的完整新手。

JDL文件:: ---- >>>>>>

entity LocationGeofenceComponent{
    id Long,
    locationID Long,
    geoCoordinate String
}

entity Location {
    id Long,
    streetAddress String,
    postalCode String,
    city String,
    stateProvince String,
    countryID String
}


entity FulfillmentProvider{
    id Long,
    providerName String
}

entity Region {
    id Long,
    regionName String
}

entity Country {
    id Long,
    countryName String
}


entity Department {
    departmentName String required
}

entity Device {
    id Long,
    deviceMACAddress String,
    deviceID Long,
    deviceKey String,
    provisionDate ZonedDateTime,
    lastHeartbeat ZonedDateTime,
    status String,
    model String
}

entity Product {
    id Long,
    productName String,
    productBC String,
    productID String,
    productWidthMM Integer,
    productHeightMM Integer,
    productDepthMM Integer,
    productNettWeightGrams Double,
    productNettVolumeMM3 Double,
    productGrossWeightGrams Double,
    productGrossVolumeMM3 Double,
    productDisplayName String
}

entity ProductPrice {
    id Long,
    productPriceEffectiveeStart ZonedDateTime,
    productPriceEffectiveEnd ZonedDateTime,
    productPrice Double,
    productDefaultPrice Double
}

entity Offer {
    id Long,
    offerPriceEffectiveStart ZonedDateTime,
    offerPriceEffectiveEnd ZonedDateTime,
    offerProductPrice Double
}

entity Brand {
    id Long,
    brandName String
}

entity User {
    id Long,
    userName String,
    userHandle String,
    userFBProfile String
}

entity Employee {
    id Long,
    firstName String,
    lastName String,
    email String,
    phoneNumber String,
    title String,
    adminOwnerID Long
}

entity PurchaseOrder {
    id Long,
    PurchaseOrderProductID Long,
    PurchaseOrderProductQty Long
}

entity FulfillmentProviderUserAccount{
        id Long,
        username String,
        otherInfo String,
        profileID String
}

entity SocialMediaIdentity{
    id Long,
    provider String,
    pricipal String,
    profileName String,
    profileInfo Blob
}

entity Bundle{
    id Long
}

entity Heartbeat{
    id Long,
    time ZonedDateTime
}

enum Language {
    FRENCH, ENGLISH, SPANISH
}

relationship OneToOne {
    Department{location} to Location,
    Device{activeLocation} to Location
}

relationship ManyToMany {
    FulfillmentProvider to Product,
    PurchaseOrder to Product,
    PurchaseOrder to Bundle,
    PurchaseOrder to Offer,
    Region to LocationGeofenceComponent
}

// defining multiple OneToMany relationships with comments
relationship OneToMany {
    User{device} to Device,
    FulfillmentProvider to FulfillmentProviderUserAccount,
    User to FulfillmentProviderUserAccount,
    Location to LocationGeofenceComponent,
    Department{employee} to Employee,
    Device{fulfillmentLocation} to Location,
    Device to Heartbeat,
    Device to PurchaseOrder,
    Country to Region,
    User to SocialMediaIdentity,
    FulfillmentProvider to SocialMediaIdentity
}

relationship ManyToOne {
    Device to User,
    Device to Product,
    PurchaseOrder to User,
    Product to Brand,
    Offer to Product,
    Bundle to Product,
    Offer to Bundle,
    Location to Country
}


// defining multiple oneToOne relationships
//relationship OneToOne {
//}

// Set service options to all except few
//service all with serviceImpl except Employee, Job
// Set an angular suffix
angularSuffix * with sxnapp


我看到的错误消息----- >>>>>>

The jdl is being parsed.
{ name: 'NullPointerException',
  message: 'The type, and at least one injected field must be passed.',
  prototype:
   Error
       at new buildException (/Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/jhipster-core/lib/exceptions/exception_factory.js:43:25)
       at new JDLRelationship (/Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/jhipster-core/lib/core/jdl_relationship.js:16:13)
       at fillAssociations (/Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/jhipster-core/lib/parser/jdl_parser.js:158:31)
       at Object.parse [as convertToJDL] (/Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/jhipster-core/lib/parser/jdl_parser.js:41:3)
       at constructor.parseJDL (/Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/generator-jhipster/generators/import-jdl/index.js:57:41)
       at Object.<anonymous> (/Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/yeoman-generator/lib/base.js:439:23)
       at /Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/run-async/index.js:25:25
       at /Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/run-async/index.js:24:19
       at /Users/anuruddhak2/MyStuff/BackedUp/code/EclipseWS/sxnapp/node_modules/yeoman-generator/lib/base.js:440:9
       at runCallback (timers.js:651:20) }
Error jhipster:import-jdl ./src/model/Model.jdl

ERROR!
Error while parsing entities from JDL

最佳答案

调整关系。我不确定您的数据如何配置,但与以下内容类似。 https://jhipster.github.io/jdl/提供的文档对其进行了更好的说明。

    relationship ManyToOne {
    Device{product} to Product{device},
    PurchaseOrder{user} to User{purchaseorder},
    Product{brand} to Brand{product},
    Offer{product} to Product{offer},
    Bundle{product} to Product{bundler},
    Offer{bundle} to Bundle{offer},
    Location{country} to Country{location}
}


无需提供默认的“ ID”列。希望能帮助到你

10-04 23:35