Ebean MetaQueryStatistical 的结果是表名 null



我尝试使用(根据 http://www.avaje.org/metatopqueries.html)

List<MetaQueryStatistic> list = Ebean.find(MetaQueryStatistic.class).findList();

获取我的查询统计信息,但我得到了

[error] Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT T0.AUTOFETCH_TUNED C0, T0.BEAN_TYPE C1, T0.ORIG_QUERY_PLAN_HASH C2, T0.FINAL_QUERY_PLAN_HASH C3, T0.SQL C4, T0.EXECUTION_COUNT C5, T0.TOTAL_LOADED_BEANS C6, T0.TOTAL_TIME_MICROS C7, T0.COLLECTION_START C8, T0.LAST_QUERY_TIME C9, T0.AVG_TIME_MICROS C10, T0.AVG_LOADED_BEANS C11 
[error] FROM NULL[*] T0 "; expected "identifier"; SQL statement:
[error] select t0.autofetch_tuned c0, t0.bean_type c1, t0.orig_query_plan_hash c2, t0.final_query_plan_hash c3, t0.sql c4, t0.execution_count c5, t0.total_loaded_beans c6, t0.total_time_micros c7, t0.collection_start c8, t0.last_query_time c9, t0.avg_time_micros c10, t0.avg_loaded_beans c11 
[error] from null t0 [42001-168]
[error]     at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
[error]     at org.h2.message.DbException.get(DbException.java:169)
[error]     at org.h2.message.DbException.getSyntaxError(DbException.java:194)

请注意,表名为 NULL,我认为这就是它失败的原因。如果你看一下这个类,你会发现它没有@Table注释。我不确定这是问题还是缺少某些配置。

阅读:

https://groups.google.com/forum/#!searchin/ebean/Statistic/ebean/3wOPQIbBuvs/f8dVZtxP54EJ

注意 - com.avaje.ebean.meta.MetaQueryStatistic 正在被替换,用于获取查询执行统计信息的新 API...

最新更新