【发布时间】:2015-11-20 20:39:14
【问题描述】:
我正在尝试在两个实体之间建立关系。
实体 Fournisseur(id,code,libelle)
实体目录(id,fournisseur_code)
我希望这两个实体之间的关系在 code 和fournisseur_code 之间。
我已经修改了实体目录的 liquibase xml 生成文件,来自
<changeSet id="20150116113044" author="jhipster"> <createTable tableName="T_CATALOGUE"> <column name="id" type="bigint" autoIncrement="true"> <constraints primaryKey="true" nullable="false"/> </column> <column name="fournisseur_id" type="bigint"/> <column name="produit_id" type="bigint"/> <column name="marque_id" type="bigint"/> <column name="pays_id" type="bigint"/> <column name="emballage_id" type="bigint"/> </createTable> <addForeignKeyConstraint baseColumnNames="fournisseur_code" baseTableName="T_CATALOGUE" constraintName="fk_catalogue_fournisseur_id" referencedColumnNames="id" referencedTableName="T_FOURNISSEUR"/>
到
<changeSet id="20150116113044" author="jhipster">
<createTable tableName="T_CATALOGUE">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="fournisseur_code" type="varchar(45)"/>
<column name="produit_id" type="bigint"/>
<column name="marque_id" type="bigint"/>
<column name="pays_id" type="bigint"/>
<column name="emballage_id" type="bigint"/>
</createTable>
<addForeignKeyConstraint baseColumnNames="fournisseur_code"
baseTableName="T_CATALOGUE"
constraintName="fk_catalogue_fournisseur_code"
referencedColumnNames="code"
referencedTableName="T_FOURNISSEUR"/>
表格生成得很好,但是当我尝试从 CatalogueResource 运行 getAll 函数时,它告诉我:
[错误] org.hibernate.engine.jdbc.spi.SqlExceptionHelper - 未知 “字段列表”中的“catalogue0_.fournisseur_id”列
我不知道为什么。 如果有人知道......
谢谢。
【问题讨论】: