Check the syntax and semantics of the targetted
queries.
boolean hasError = false;
String query = null;
PersistenceDescriptor desc = ((EjbCMPEntityDescriptor)ejbDesc).getPersistenceDescriptor();
for (Iterator it = desc.getQueriedMethods().iterator(); it.hasNext();) {
MethodDescriptor method = (MethodDescriptor) it.next();
try {
QueryDescriptor qDesc = desc.getQueryFor(method);
query = qDesc.getQuery();
if (qDesc.getIsEjbQl()) {
Method m = method.getMethod(ejbDesc);
int retypeMapping = mapRetType(qDesc.getReturnTypeMapping());
boolean finder = false;
if ((method.getName()).startsWith("find")) {
finder = true;
retypeMapping = 2; /*QueryDescriptor.NO_RETURN_TYPE_MAPPING;*/
}
ejbqlDriver.compile(query, m, retypeMapping, finder, ejbDesc.getName());
}
} catch (EJBQLException ex) {
ex.printStackTrace();
if (!hasError) {
hasError = true;
}
result.addErrorDetails
(smh.getLocalString(ownerClassName + ".parseError",
"Error: [ {0} ] has parsing error(s)",
new Object[] {query}));
result.addErrorDetails
(smh.getLocalString(ownerClassName + ".SAXParseException",
"Exception occured : [{0}]",
new Object[] {ex.toString()}));
}
}
if (hasError == false) {
result.addGoodDetails
(smh.getLocalString(ownerClassName + ".passed",
" Syntax and Semantics of the Queries are correct",
new Object[] {}));
}
return hasError;