我有一个非常痛苦的错误,自四天以来我一直在寻找解决方案。因此,我想使用两个实体文件夹和客户端之间的jhipster命令建立多对多关系,并且文件夹实体是该关系的所有者。因此,在建立关系之后,我尝试发布客户端,但出现此错误:
could not prepare statement; SQL [insert into client (firstname, lastname, username, id) values (?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement",
当我尝试获取文件夹时,出现该错误:
could not prepare statement; SQL [select distinct folder0_.id as id1_2_0_, client2_.id as id1_0_1_, folder0_.author as author2_2_0_, folder0_.deposit_date as deposit_3_2_0_, folder0_.identifier as identifi4_2_0_, folder0_.metadata_1 as metadata5_2_0_, folder0_.metadata_2 as metadata6_2_0_, folder0_.metadata_3 as metadata7_2_0_, client2_.firstname as firstnam2_0_1_, client2_.lastname as lastname3_0_1_, client2_.username as username4_0_1_, clients1_.folders_id as folders_1_3_0__, clients1_.clients_id as clients_2_3_0__ from folder folder0_ left outer join folder_client clients1_ on folder0_.id=clients1_.folders_id left outer join client client2_ on clients1_.clients_id=client2_.id]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement",
两个实体中的关系代码如下:
文件夹的一面:
@ManyToMany
@JoinTable(name = "folder_client",
joinColumns = @JoinColumn(name = "folders_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "clients_id", referencedColumnName = "id"))
private Set<Client> clients = new HashSet<>();
和客户端:
@ManyToMany(mappedBy = "clients")
@JsonIgnore
private Set<Folder> folders = new HashSet<>();
有人对如何解决这个问题有想法吗?并感谢:):)