Ich habe PolicyDO und PolicyDocumentDO.relation zwischen ihnen ist wie folgtHibernateException: Eine Sammlung mit Kaskade = „all-löschen-Waise“ wurde nicht mehr von der besitzenden Entitätsinstanz verwiesen
PolicyDO.hbm.xml
<bag name="listPolicyDocumentDOList" cascade="all-delete-orphan" lazy="false" inverse="true">
<key column="POLICYSEQ" />
<one-to-many class="dataobjects.policy.PolicyDocumentDO" />
PolicyDO.java
protected List<PolicyDocumentDO> policyDocumentDOList = new ArrayList<PolicyDocumentDO>();
public java.util.List<PolicyDocumentDO> getListPolicyDocumentDOList() {
return this.policyDocumentDOList;
}
public void setListPolicyDocumentDOList(java.util.List<PolicyDocumentDO> list) {
policyDocumentDOList.clear();
policyDocumentDOList = list;
}
PolicyDocumentDO.hbm.xml
<many-to-one name="parentGuidObj" class="dataobjects.policy.PolicyDO" not-null="true" >
<column name="POLICYSEQ" />
</many-to-one>
Wann immer ich versucht, wie ich Fehler erhalten folgende unten
session = sessionFactory.openSession();
Query query = session.createQuery(strBuff.toString());
List listQuery = query.list();
etwas von Datenbank abzufragen
org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance:
dataobjects.policy.PolicyDO.listPolicyDocumentDOList
So nach googeln ich Änderungen haben folgende während listPolicyDocumentDOList in PolicyDO
Einstellungpublic void setListPolicyDocumentDOList(java.util.List<PolicyDocumentDO> list) {
policyDocumentDOList.clear();
policyDocumentDOList = list;
}
Dann bin ich auch über Fehler. Was kann ich noch tun, um diesen Fehler zu beheben? Dank
versuchen mit [diese] (http://stackoverflow.com/a/5587892/2586617) –