org.hibernate.AnnotationException:未知的mappedBy - Jhipster onetoone关系

问题描述 投票:0回答:1

我在jhipster中定义的onetoone关系中遇到了这个异常:

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}
 }

请注意,我在运行项目时遇到了这个异常,因为在我导入了enetities和关系之后它被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)**


[email protected] C:\myjh\relwithusers6
`-- [email protected]



##### **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!
jhipster one-to-one
1个回答
0
投票

我想它应该是这样的:

relationship OneToOne {
    OrdemItem(warehouse) to Warehouse {orderItem}
}

因为关系的所有者是OrdemItem。

more example here

© www.soinside.com 2019 - 2024. All rights reserved.