many-to-many - jhipster中多对多关系的问题
问题描述
我有一个非常痛苦的错误,四天以来我一直在寻找解决方案。所以我想用 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<>();
那么有人知道如何解决这个问题吗???谢谢:) :)
解决方案
推荐阅读
- azure-sql-database - 动态系统功能所需的权限
- java - 如何使用 javafx 执行 Timer 类,其中 javafx 对象更改
- ios - 如何在 Swift 中使用 CAShapeLayer 为 CALayer.SubLayer 创建橡皮擦
- python - Pyspark 将结构数组转换为字符串
- c# - 如何观察不同类别的整数
- php - 使用 .htaccess 在 localhost 上重定向 Wordpress 页面时,Page slug 无休止地重复
- file - 将 https 重定向到 http(下载文件)
- r - R - 从文本文档中提取字符串
- python - tk_app.mainloop() 导致 mac 崩溃并重新启动
- go - 尝试了 monad 模式,但仍然有重复的错误处理