I have a simple one-to-many mapping which looks the following using xdoclet in my class PersistentReportDefinition
:
@hibernate.set inverse="true" table="time_span" lazy="false" name="timeSpans" cascade="all-delete-orphan
"
@hibernate.collection-key column="report_def_id"
@hibernate.collection-one-
to-many class="com.nexusatwork.nrs
.collectab
le.persist
ence.mappe
d.Persiste
ntTimeSpan
"
I first create a ReportDefinition which has three such PersistentTimeSpanS in a Set. This works very well, they are saved cascading.
Later on I want to delete a time span from the set. But I do not have the original instance of PersistentReportDefinition
, so I build up a new one but with only 2 PersistentTimeSpanS in the set. The primary keys are set, so hibernate knows it has to update and not to insert.
The problem is, that it does not delete the PersistentTimeSpan which is not in the Set. Does Hibernate only realize it has to remove when I actually call remove on the Set, or whats the problem?
Start Free Trial