如何使用extackJ获取JOOQ查询文本而不更改查询方法本身?
有一个使用JOOQ的项目。 该方法的示例:
public List<A> getA(List<String> C) {
return context
.select(...)
.from(...)
.join(...).on(...)
.where(...)
.fetch().map(...);
}
您需要使用factionj获取请求文本。
根据第一个,HPQL和JDBC的一切都可以 - 我们根据第二次的注释 - 我们使用公共JDBC类的查询拦截了参数。
JDBC的示例点:
@Pointcut("target(org.springframework.jdbc.core.JdbcTemplate) && " +
"args(String, ..) && (call(* query(..)) || call(* update(..)) || call(* batchUpdate(..)))")
public void executeMetricsRepository() { }
但是您在这里可以做什么?它是随着方面的应用,因为不考虑重写每个请求。
这里有两个部分-Fetch()和Map()。但是对 - 获取。
提取----&gt;接口org.jooq.resultQuery
继承类:
ApptractresultQuery和SelectImpl。但这是包装私有化的。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您是否必须使用这种基于注释的方法
,但我不确定您是否不确定您是否必须在应用程序中提取 每个 JOOQ查询的SQL查询非常容易通过添加 到您的JOOQ
配置
,例如,使用eactive
j JOOQ
query
类型具有查询的生成的SQL。这比上述方法的效率要低一些,因为它将第二次重新生成SQL字符串,但这可能与您的应用程序无关?Alternative approach without AspectJ
I'm not sure if you have to use this annotation based approach, but it is very easy to extract the SQL query for every jOOQ query in your application by adding an
ExecuteListener
to your jOOQConfiguration
, e.g.Possibility to use AspectJ
The jOOQ
Query
type has aQuery.getSQL()
method which can be used to extract the generated SQL for anyQuery
. That's a bit less efficient than the above approach, because it will re-generate the SQL string a second time, but that might be irrelevant to your application?