2017-03-15 25 views
0

我是新來的。我正在嘗試使用JHispter創建一個新的應用程序。添加jHipster實體形成JDL文件時出錯

我已經使用「yo jhipster」命令來生成應用程序。

我已經使用JDL工作室來開發我的實體,但是,當我使用帶有「yo jhipster:import-jdl model.jdl」的JDL時,我收到一個錯誤 - 但錯誤信息並不能提供什麼線索導致錯誤。

我看到的錯誤信息和我的JDL文件的內容如下。請讓我知道我該如何調試。請注意,我是一個完全新手jysster,以及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 

回答

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」列。希望它有幫助