org.hibernate.AnnotationException:未知mappingBy-Jhipster一对一关系

时间:2019-03-04 15:24:51

标签: jhipster one-to-one

我在jhipster中定义的一对一关系中有此异常:

org.hibernate.AnnotationException: Unknown mappedBy in: 
com.plan.vima.domain.Warehouse.orderItem, referenced property unknown: 
com.plan.vima.domain.OrdemItem.ordemItem

这是我添加的关系并导致了我的问题:

 relationship OneToOne {
      OrdemItem to Warehouse {orderItem}
 }

请注意,在导入项目和关系后,jhipster对项目进行了处理,因此我在运行该项目时遇到了此异常-我没有编写任何代码。

这是我完整的Jhipster项目信息:

C:\myjh\relwithusers6>jhipster info
Using JHipster version installed locally in current project's node_modules
Executing jhipster:info
Options:
Welcome to the JHipster Information Sub-Generator

##### **JHipster Version(s)**


relwithusers-6@0.0.0 C:\myjh\relwithusers6
`-- generator-jhipster@5.0.1



##### **JHipster configuration, a `.yo-rc.json` file generated in the root folde
r**


<details>
<summary>.yo-rc.json file</summary>
<pre>
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.plan.vima"
    },
    "jhipsterVersion": "5.0.1",
    "applicationType": "monolith",
    "baseName": "relwithusers6",
    "packageName": "com.plan.vima",
    "packageFolder": "com/plan/vima",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "replaced-by-jhipster-info",
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "npm",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": false
  }
}
</pre>
</details>


##### **JDL for the Entity configuration(s) `entityName.json` files generated in
 the `.jhipster` directory**

<details>
<summary>JDL entity definitions</summary>

<pre>
entity Ordem (ordem) {
  ordemNumber String,
  dateOpen Instant,
  dateClose Instant,
  totalAmount Double,
  orderstatus Orderstatus
}
entity OrdemItem (ordem_item) {
  quantityRequired Integer,
  quantityNegotiated Integer,
  quantityShipped Integer,
  orderstatus Orderstatus
}
entity Warehouse (warehouse) {
  unitPrice Double,
  quantityRemaining Integer
}
entity Product (product) {
  productName String,
  unitPrice Double,
  isDiscontinued Boolean
}

enum Orderstatus {
  REQUIRED,
  ABORTED,
  SHIPPED,
  PARTIALLTYSHIPPED,
  NOTSHIPPED,
  NOPROD_NOTSHIPPED
}

relationship OneToOne {
  OrdemItem{warehouse} to Warehouse
}
relationship OneToMany {
  Ordem{orderItem} to OrdemItem{ordem},
  Product{orderItem} to OrdemItem{product}
}
relationship ManyToOne {
  Ordem{user(login)} to User,
  Product{user(login)} to User
}

paginate Ordem, OrdemItem, Warehouse, Product with pagination

</pre>
</details>


##### **Environment and Tools**

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

git version 2.20.1.windows.1

node: v10.15.1

npm: 6.7.0

yeoman: 2.0.5

Congratulations, JHipster execution is complete!

1 个答案:

答案 0 :(得分:0)

我认为应该是这样的:

for cat in categories:
    for column in '{}_feature_columns'.format(cat):
        print (column)

因为关系的所有者是OrdemItem。

请参见more example here