[hibernate-dev] Exception model

Hardy Ferentschik hibernate at ferentschik.de
Thu Feb 19 05:29:51 EST 2009


On Wed, 18 Feb 2009 10:45:50 +0100, Emmanuel Bernard  
<emmanuel at hibernate.org> wrote:

> ???    UnsupportedTypeException or should it be  
> AmbiguousConstraintUsageException

Or just AmbiguousConstraintException?


> Constraint implementation
>      ConstraintInitializationException
> ???        initialize() must raise a RTE will be wrapped OR should we  
> not wrap
>      UnsupportedTypeException
>           isValid incompatible type (detected by impl) => same as  
> "declared property type property has no match"
>      ConstraintExcecutionException
>           isValid throws a RTE will be wrapped into  
> ConstraintValidatorExecutionException
>      ConstraintCreationException
>           ConstraintValidatorFactory fails with RTE. Wraps it.
>
> ???  should we collapse that into a ConstraintExecutionException or even  
> ValidationException

I could imagine to just use ValidationException in the case of  
ConstraintInitializationException, ConstraintExcecutionException,  
ConstraintCreationException
I don't know which different type of action a developer should take in the  
case these exception exist. And is ConstraintExcecutionException not really
just another name for ValidationException?


> 3. Bootstrap

> ConfigurationException
>    cannot read XML cong
>    more than one XML conf
>    no no-arg constructor on classes described by XML
>
> MappingException
>    cannot read XML mapping
>    entity described more than once
>    field/getter described more than once
>    Wrong class / field  / getter name
>    Wrong constraint declaration
>    Wrong constraint definition

What's about combining ConfigurationException and MappingException into  
just ConfigurationException?


> B. EXCEPTION MODEL
>
> We have three approaches:
>
> 1. specialize an exception when the application can do something about it
> In this case all exceptions are ValidationException except  
> ConstraintViolationException

+1 for this approach.

--Hardy




More information about the hibernate-dev mailing list