1

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

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

我已经使用 JDL 工作室来开发我的实体,但是,当我将 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
4

1 回答 1

1

调整你的人际关系。我不确定您的数据是如何配置的,但类似于以下内容。文档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”列。希望能帮助到你

于 2017-03-18T05:12:05.913 回答