use of org.hibernate.hql.internal.ast.DetailedSemanticException in project hibernate-orm by hibernate.
the class ConstructorNode method resolveConstructor.
private Constructor resolveConstructor(String path) throws SemanticException {
String importedClassName = getSessionFactoryHelper().getImportedClassName(path);
String className = StringHelper.isEmpty(importedClassName) ? path : importedClassName;
if (className == null) {
throw new SemanticException("Unable to locate class [" + path + "]");
}
try {
final Class holderClass = getSessionFactoryHelper().getFactory().getServiceRegistry().getService(ClassLoaderService.class).classForName(className);
return ReflectHelper.getConstructor(holderClass, constructorArgumentTypes);
} catch (ClassLoadingException e) {
throw new DetailedSemanticException("Unable to locate class [" + className + "]", e);
} catch (PropertyNotFoundException e) {
// locate an appropriate constructor
throw new DetailedSemanticException(formatMissingContructorExceptionMessage(className), e);
}
}
use of org.hibernate.hql.internal.ast.DetailedSemanticException in project hibernate-orm by hibernate.
the class HQLTest method testExceptions.
@Test
public void testExceptions() throws Exception {
DetailedSemanticException dse = new DetailedSemanticException("test");
dse.printStackTrace();
dse.printStackTrace(new PrintWriter(new StringWriter()));
QuerySyntaxException qse = QuerySyntaxException.convert(new RecognitionException("test"), "from bozo b where b.clown = true");
assertNotNull(qse.getMessage());
}
Aggregations