hi all, i have an entity that reference another entity with a many-to-
one relationship, on that i have a not-null constraint.

when i save the 2 entities and try to delete only the "child" i have
an exception

NHibernate.Exceptions.GenericADOException : could not delete: ****

wich wraps a FirebirdException

{"violation of FOREIGN KEY constraint \"FK8AA4DA8DBBC1B4CD\" on table
\"RootEntities\"\r\nNo message for error code 335544839 found."}


i would like to throw a custom EntityDependenciesException wich wraps
the GenericAdoException but i have 2 problem:

1 - where catch the AdoNetException? using ITransaction the exception
isn't throw on the calls to the session.delete method but at
itransaction.commit, so i hope that there's a place in nhibernate code
where i can intercept the calls to the code wich will esecute the
delete sql

2 - how understand that the exception is generate by the deletion of
an entities referenced by another ent?
  sure i can parse the firebird exception to find the tag "violation
of FOREIGN KEY constraint ***" but this is
  -firebird specific
  -not 100% sure becouse maybe the foreign key exception is generated
by another error

somebody have some idea of how to implement that?

ps. my real code is complex so i can't implements an AD HOC solution
to use only for the deletion of a particular entity type

thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to