I've got an object model that utilizes Processes (a sub class of what were calling Tasks) which can have one to many Schedules underneath as children... see below for the mapping relationship.
I'm seeing a problem when getting Processes using the list method of the Criteria class filtering by Example (see below). Basically when Hibernate is flushing collections before retrieving my list on the second list call, it sees an unreachable item in the schedule collection that doesn't seem to be associated with my session. This throws an AssertionFailure with the message "owner not associated with session" from the call to SessionImpl.updateUnreachableCollection.
I know this may not be a whole lot to go on, but I'm hoping that someone might be able to give advice on where I could look to see how this collection's owner is getting lost.
- Paul
Hibernate version:
version 2.1.6
Mapping documents:
From Task.hbm.xml
<set
name="schedules"
lazy="true"
inverse="true"
cascade="all-delete-orphan"
sort="eg.ScheduleSequenceComparator"
>
<key
column="PROCESS_ID"
>
</key>
<one-to-many
class="eg.Schedule"
/>
</set>
From Schedule.hbm.xml
(note e.g.Process is a child of eg.Task)
<many-to-one
name="parentProcess"
class="eg.Process"
cascade="none"
outer-join="auto"
column="PROCESS_ID"
not-null="false"
/>
Code between sessionFactory.openSession() and session.close():
Calls this first....
lst = session.createCriteria(RootProjectProcess.class).addOrder(order).setFetchMode("predecessorTasks", FetchMode.EAGER).setFetchMode("schedules", FetchMode.EAGER).setFetchMode("refElements", FetchMode.EAGER).setFetchMode("fieldDefs", FetchMode.EAGER).add(ex).list();
Then calls this second....
lst = session.createCriteria(RootApprovalProcess.class).add(ex).list
Name and version of the database you are using:
SQL Server 2000
|