I have a class Action and a class Workflow. They are mapped as a many-
to-one relationship.
<class name="Action" lazy="true" >
...
<many-to-one name="Workflow" class="Workflow" column="Workflow_Id"
cascade="all-delete-orphan"/>
...
</class>
When I delete an object of class action, I see the following in
NHProf:
begin transaction with isolation level: Unspecified
DELETE FROM [Actions]
WHERE [Id] = 91 /* @p0 */
DELETE FROM [Workflows]
WHERE [Id] = 30 /* @p0 */
commit transaction
Within the same http request (and thus hibernate session due to the
'web' life cycle) but after closing the transaction performing the
delete, NH tries to update my child Workflow object whenever I try
accessing the session in a new transaction.
begin transaction with isolation level: Unspecified
UPDATE [Workflows]
SET [Name] = 'Some name' /* @p0 */
WHERE [Id] = 30 /* @p1 */
ERROR: Could not synchronize database state with session
rollback transaction
It looks like the child Workflow object is still associated with the
NH session although it has been deleted by cascading from its parent.
Furthermore it is marked dirty as NH tries to update it.
Why is this happening? Surely the child object shouldn't be updated in
the 2nd transaction. Btw: I'm using NH 2.1.2.4000
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.