* @return a DatabaseQuery representing the given ejbql
*/
public static DatabaseQuery buildEJBQLDatabaseQuery(String queryName, String ejbql,
Boolean flushOnExecute, Session session, HashMap hints, ClassLoader classLoader) {
DatabaseQuery databaseQuery = null;
EJBQLParseTree parseTree = EJBQLParser.buildParseTree(queryName, ejbql);
parseTree.setClassLoader(classLoader);
databaseQuery = parseTree.createDatabaseQuery();
databaseQuery.setEJBQLString(ejbql);
parseTree.populateQuery(databaseQuery, (oracle.toplink.essentials.internal.sessions.AbstractSession)session);
//Bug#4646580 Add arguments to query
parseTree.addParametersToQuery(databaseQuery);
((EJBQLCallQueryMechanism)databaseQuery.getQueryMechanism()).getEJBQLCall().setIsParsed(true);
databaseQuery.setFlushOnExecute(flushOnExecute);
//GF#1324 toplink.refresh query hint does not cascade
//cascade by mapping as default for read query