You can "turn off" the disassociating UPDATE be using a bidirectional
association with readonly="true" for the collection mapping.




                                                                                       
                                               
                    jiesheng zhang                                                     
                                               
                    <[EMAIL PROTECTED]>                To:     [EMAIL PROTECTED]       
                      
                    Sent by:                                cc:                        
                                               
                    [EMAIL PROTECTED]       Subject:     [Hibernate] hibernate set 
foreign key to null before issue   
                    eforge.net                               deletion?                 
                                               
                                                                                       
                                               
                                                                                       
                                               
                    31/01/03 01:50 AM                                                  
                                               
                                                                                       
                                               
                                                                                       
                                               




suppose I have two table
create table A (
           id integer primary key
           );
create table B (
           id integer primary key,
           idA integer not null,
           constraint FK_B_TO_A foreign key (idA) references A
(id) on delete cascade
           );
Here suppose A to B is a one-to-many association  and
I did not ask the hibernate to do the cascade in the
mapping file since I do it in the database by
specifying "on delete cascade"; I think it will be
effecient to let the database to do the cascading
deletion. (Am I right here?).

If I call Session.delete(A), the Session will issue
these two queries:
1. update B set idA = null where idA =?
2. delete from A where id = ?
Apparently hibernate wants to dissociate B from A
before it issues the deletion.
How can I turn this off?
Or any alternative solution?

I am trying to convince my CTO to use hibernate in a
project. However I promise a demo to him sometime
today. Any help is really appreciated.

jason


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel




**********************************************************************
Any personal or sensitive information contained in this email and
attachments must be handled in accordance with the Victorian Information
Privacy Act 2000, the Health Records Act 2001 or the Privacy Act 1988
(Commonwealth), as applicable.

This email, including all attachments, is confidential.  If you are not the
intended recipient, you must not disclose, distribute, copy or use the
information contained in this email or attachments.  Any confidentiality or
privilege is not waived or lost because this email has been sent to you in
error.  If you have received it in error, please let us know by reply
email, delete it from your system and destroy any copies.
**********************************************************************





-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to