use of org.apache.cayenne.template.parser.ParseException in project cayenne by apache.
the class CayenneSQLTemplateProcessor method process.
protected SQLStatement process(String template, Context context) {
Node node = templateCache.get(template);
if (node == null) {
SQLTemplateParser parser = parserPool.get();
try {
parser.ReInit(new ByteArrayInputStream(template.getBytes()));
node = parser.template();
} catch (ParseException | TokenMgrError ex) {
throw new CayenneRuntimeException("Error parsing template '%s' : %s", template, ex.getMessage());
} finally {
parserPool.put(parser);
}
// can ignore case when someone resolved this template concurrently, it has no side effects
templateCache.put(template, node);
}
node.evaluate(context);
return new SQLStatement(context.buildTemplate(), context.getColumnDescriptors(), context.getParameterBindings());
}
Aggregations