【发布时间】:2015-12-12 17:06:59
【问题描述】:
我正在尝试手动使用 @ElementCollection,因为 jhipster 文档的关系部分中没有提到它。我更改了 java 类,尝试通过 mvn liquibase:diff 生成具有更改的 liquibase 文件,然后在我的 entity.json 中包含一个关系
"relationships": [
{
"relationshipId": 1,
"relationshipName": "contato_telefone",
"otherEntityName": "telefone",
"relationshipType": "one-to-many",
"otherEntityField": "telefone",
"ownerSide": true
}
实体类
@ElementCollection
@CollectionTable(name = "contato_telefone", joinColumns = @JoinColumn(name = "id_contato"))
@Column(name = "telefone")
private List<String> telefone;
当我尝试运行应用程序时,我得到了一个 LazyInitiationException 并且没有创建关系表 contato_telefone。我错过了什么吗?我需要做什么来解决这个问题?
【问题讨论】: