通过关系***找到了一个新实体,该实体未配置为级联实体的持久化操作 [英] A new entity was found through the relationship *** that was not configured to cascade persist operations for entity

查看:264
本文介绍了通过关系***找到了一个新实体,该实体未配置为级联实体的持久化操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为某些测试创建一些固定装置,但遇到了此错误。你有解决的办法吗?

I'm currently creating some fixtures for some tests and i faced this error. Have you an idea about how to solve it ?

我有很多可以复制粘贴的装置。

I've so many fixtures to copy paste it.

A new entity was found through the relationship '***' that was not configured to cascade persist operations for entity: 
***. To solve this issue: Either explicitly call EntityManager#persist() on     
this unknown entity or configure cascade persist  this association in the 
mapping for example @OneToOne(..,cascade={"persist"}). If you cannot find 
out which entity causes the problem implement '***#__toString()' to get a clue.


推荐答案

该错误表示在当前尚未保存到数据库的对象。您需要确保您的关系设置为级联持久性调用(这意味着它将自动保存该调用),或者您需要在保存当前实体之前对未保存的实体进行持久化。

The error means that there is a related entity in a current object that has not been saved to the database yet. You either need to make sure your relationship is set to cascade persist calls (meaning it will save this automatically) or you need to persist the unsaved entity before saving the current entity.

这篇关于通过关系***找到了一个新实体,该实体未配置为级联实体的持久化操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆