If I have a @Loader annotation and the named query is not validated, the HibernateException only contains the name of the queries that failed, but not the cause. So, in SessionFactoryImpl, instead of throwing this exception:
if ( !errors.isEmpty() ) {
StringBuilder failingQueries = new StringBuilder( "Errors in named queries: " );
String sep = "";
for ( Map.Entry<String, HibernateException> entry : errors.entrySet() ) {
LOG.namedQueryError( entry.getKey(), entry.getValue() );
failingQueries.append( sep ).append( entry.getKey() );
sep = ", ";
}
throw new HibernateException( failingQueries.toString() );
}
We should pass the errors Map to the exception as well. |