我已经看到了几个答案,但是都没有解决我的问题。
我什至没有尝试删除,但我将状态设置为-1,并且在应用程序的其他位置将对象过滤为其状态,因此必须将其删除。
我正在尝试将user.status设置为-1
RectTransform
用户在其班上有这个
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FitParentToChildren : MonoBehaviour
{
#region INTERNAL
public RectTransform parent;
public RectTransform[] children;
public float minX = 100000;
public float maxX = -100000;
public float minY = 100000;
public float maxY = -100000;
#endregion
#region INITIALIZATION
void Awake()
{
parent = GetComponent<RectTransform>();
children = GetComponentsInChildren<RectTransform>();
}
void Start()
{
SetMinMaxValues();
FitToChildren();
}
#endregion
#region BEHAVIOURS
private void FitToChildren()
{
parent.sizeDelta = GetNewRect();
parent.anchoredPosition = GetTopLeftCornerPositon();
}
private void SetMinMaxValues()
{
for (int i = 1; i < children.Length; i++)
{
float tempMinX = children[i].anchoredPosition.x - children[i].sizeDelta.x / 2;
if (tempMinX < minX) minX = tempMinX;
float tempMaxX = children[i].anchoredPosition.x + children[i].sizeDelta.x / 2;
if (tempMaxX > maxX) maxX = tempMaxX;
float tempMinY = children[i].anchoredPosition.y - children[i].sizeDelta.y / 2;
if (tempMinY < minY) minY = tempMinY;
float tempMaxY = children[i].anchoredPosition.y + children[i].sizeDelta.y / 2;
if (tempMaxY > maxY) maxY = tempMaxY;
}
}
private Vector2 GetNewRect()
{
return new Vector2 (maxX - minX, maxY - minY);
}
private Vector2 GetTopLeftCornerPositon()
{
return new Vector2 (minX, maxY);
}
#endregion
}
这在UserGroupMembership中
user.setType(-1);
userService.updateUser(user);
错误是
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "user_id", updatable = false)
@LazyCollection(LazyCollectionOption.FALSE)
private List<UserGroupMembership> groupMemberships = new ArrayList<UserGroupMembership>();
有人可以帮忙吗?
答案 0 :(得分:0)
我正在更新的实体缺少一些缺失的属性,这些属性被删除了,我通过重新获取实体来重新连接它们,这很好。