JPA Hibernate 多对多 NestedServletException 问题
JPA Hibernate Many to Many NestedServletException issue
当我添加对具有 ID 的工作的查询、将它们添加到 Employee 实体中的工作集并保存 Employee 实体时出现此错误
2020-02-29 18:01:53.689 WARN 18280 --- [nio-8083-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.WhosebugError]
2020-02-29 18:01:53.692 WARN 18280 --- [nio-8083-exec-2] o.h.e.loading.internal.LoadContexts : HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@52efd6dc<rs=HikariProxyResultSet@690866176 wrapping Result set representing update count of 2>
2020-02-29 18:01:53.692 WARN 18280 --- [nio-8083-exec-2] o.h.e.loading.internal.LoadContexts : HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@4d7d18da<rs=HikariProxyResultSet@2035306242 wrapping Result set representing update count of -1>....
.....
员工实体
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.DETACH, CascadeType.REFRESH}, fetch = FetchType.LAZY)
@Fetch(value= FetchMode.SELECT)
@JoinTable(name = "employees_jobs",
joinColumns = @JoinColumn(name = "employee_id"),
inverseJoinColumns = @JoinColumn(name = "job_id"))
工作实体
@ManyToMany(mappedBy = "jobs")
private Set<Employee> employees = new HashSet<>();
提前致谢!
已解决!是龙目岛造成了这个问题。我删除了@Data 注释并添加了
@ToString(exclude = "listName")
在实体 class 之上。 Lombok生成的ToString方法是Whosebug错误的原因
当我添加对具有 ID 的工作的查询、将它们添加到 Employee 实体中的工作集并保存 Employee 实体时出现此错误
2020-02-29 18:01:53.689 WARN 18280 --- [nio-8083-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.WhosebugError]
2020-02-29 18:01:53.692 WARN 18280 --- [nio-8083-exec-2] o.h.e.loading.internal.LoadContexts : HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@52efd6dc<rs=HikariProxyResultSet@690866176 wrapping Result set representing update count of 2>
2020-02-29 18:01:53.692 WARN 18280 --- [nio-8083-exec-2] o.h.e.loading.internal.LoadContexts : HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@4d7d18da<rs=HikariProxyResultSet@2035306242 wrapping Result set representing update count of -1>....
.....
员工实体
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.DETACH, CascadeType.REFRESH}, fetch = FetchType.LAZY)
@Fetch(value= FetchMode.SELECT)
@JoinTable(name = "employees_jobs",
joinColumns = @JoinColumn(name = "employee_id"),
inverseJoinColumns = @JoinColumn(name = "job_id"))
工作实体
@ManyToMany(mappedBy = "jobs")
private Set<Employee> employees = new HashSet<>();
提前致谢!
已解决!是龙目岛造成了这个问题。我删除了@Data 注释并添加了
@ToString(exclude = "listName")
在实体 class 之上。 Lombok生成的ToString方法是Whosebug错误的原因