Get SQL query and parameters from af:search

Posted: April 25, 2014 in ADF Programmatically
Tags: , , ,

There are very few references about this so I thought to post it here.

To get the query you have to override the executeQueryForCollection() in your ViewObjectImpl. Before calling super(), you can get/print out the result of getQuery() method.

protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {
getQueryParameters();
q = getQuery();
System.out.println(“SQL = ” + q);
if (params != null) {
for (int i = 0; i < params.length; i++) {
Class cls = params[i].getClass();
System.out.println(“Class is ” + cls.getName());
System.out.println(“Query param ” + i + ” ” + String.valueOf(params[i]));
}
}
super.executeQueryForCollection(qc, params, noUserParams);
}

Comments

Leave a comment