[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2792) Session.delete is validate all fields are null

Pavel Vojtěchovský (JIRA) noreply at atlassian.com
Fri Feb 1 08:00:55 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29437 ] 

Pavel Vojtěchovský commented on HHH-2792:
-----------------------------------------

It is problem even in case of handling of bidirectional relations. E.g. there is object of type A which has relation to child objects of type B. The child object of type B has reference to its parent of type A. The code I use assures that when instance of B is removed from A then reference from B to A is set to null (so java model is consistent). But this causes problem during hibernate delete of instance of type B, which checks nullability on objects which are just deleted. 

The reference from B to A is marked with not-null="true" because B must not be in DB without this reference set to not null value.

With current (I think wrong) hibernate behaviour there is no good solution. I might
A) to keep reference from B to A set (even if it no more exists) - but it makes java model inconsitent :-(
B) to remove constraint from hibernate mapping, but I want to have this constraint, because it assures consistency of DB structure.
C) I tried to write custom Delete event handler, but current implementation depends on classes and methods with package visibility so it was not  possible :-((( without copying several hibernate classes...
D) to patch hibernate by code which has commented call of nullability check.

Could anybody explain why the nullability check is good/necessary during delete of object???

> Session.delete is validate all fields are null
> ----------------------------------------------
>
>                 Key: HHH-2792
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2792
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>            Reporter: Daniel Passos
>
> session.delete operation would not have to validate if the fields are null
> The problem in DefaultDeleteEventListener.deleteEntity -> Nullability.checkNullability

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the hibernate-issues mailing list