There is a project using JOOQ. Example of the method:
public List<A> getA(List<String> C) {
return context
.select(...)
.from(...)
.join(...).on(...)
.where(...)
.fetch().map(...);
}
You need to use AspectJ to get the request text.
Everything is OK with HPQL and JDBC, according to the first - we work with the annotation, according to the second - we intercept the parameter with the query from the public JDBC class.
Example point for JDBC:
@Pointcut("target(org.springframework.jdbc.core.JdbcTemplate) && " +
"args(String, ..) && (call(* query(..)) || call(* update(..)) || call(* batchUpdate(..)))")
public void executeMetricsRepository() { }
But what can you do here? It is with the application of the aspect, because rewriting each request is not considered.
There are two parts here - fetch() and map(). But interested in - fetch.
fetch ---> interface org.jooq.ResultQuery
Inherited classes:
AbstractResultQuery and SelectImpl. But it is package-private.