Which version of NH are you using ? To catch and convert your RDBMS exception the right way is an implementation of ISQLExceptionConverter
BTW http://groups.google.com.ar/group/nhusers/browse_thread/thread/c42e470cb1991bc1/2bdd5a041f387e5c?hl=es&lnk=gst&q=ISQLExceptionConverter#2bdd5a041f387e5c http://groups.google.com.ar/group/nhusers/browse_thread/thread/3f2b9851ded57e12/10da89aff4e1bba0?hl=es&lnk=gst&q=ISQLExceptionConverter#10da89aff4e1bba0 http://groups.google.com.ar/group/nhusers/browse_thread/thread/72c1e8872ea5c221/a0da5b852501e738?hl=es&lnk=gst&q=ISQLExceptionConverter#a0da5b852501e738 2008/10/21 CassioT <[EMAIL PROTECTED]> > > Hi, > > I was reading an article - > > > http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html > > about exception handling and this paragraph took my attention: > > "Wrapping an exception can provide extra information to the user by > adding your own message (as in the example above), while still > preserving the stack trace and message of the original exception. It > also allows you to hide the implementation details of your code, which > is the most important reason to wrap exceptions. For instance, look at > the Hibernate API. Even though Hibernate makes extensive use of JDBC > in its implementation, and most of the operations that it performs can > throw SQLException, Hibernate does not expose SQLException anywhere in > its API. Instead, it wraps these exceptions inside of various > subclasses of HibernateException. Using the approach allows you to > change the underlying implementation of your module without modifying > its public API." > > I can catch MySql exceptions from nhibernate like this one: "Cannot > delete or update a parent row" (I know this is only the message but > the exception type is MySql.Data.MySqlClient.MySqlException) > > Is this intentional or it will be modified in the future? What do you > think about it? > > Thanks, > > Cassio Tavares > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
