播放框架ebean RawSql分页
是否可以对自定义SQL查询使用分页?例如,当我设置此查询时:播放框架ebean RawSql分页,sql,playframework,pagination,ebean,rawsql,Sql,Playframework,Pagination,Ebean,Rawsql,是否可以对自定义SQL查询使用分页?例如,当我设置此查询时: String sql = "SELECT q.event_id AS event_id," + " MIN(q.total_price) AS price_min, " + " MAX(q.total_price) AS price_max " + "FROM quote q "
String sql =
"SELECT q.event_id AS event_id,"
+ " MIN(q.total_price) AS price_min, "
+ " MAX(q.total_price) AS price_max "
+ "FROM quote q "
+ "WHERE q.quote_status_id = 2 "
+ " AND q.event_id IS NOT NULL "
+ "GROUP BY q.event_id";
RawSql rawSql = RawSqlBuilder.unparsed(sql)
.columnMapping("event_id", "event.id")
.columnMapping("price_min", "priceMin")
.columnMapping("price_max", "priceMax")
.create();
com.avaje.ebean.Query<salesPipelineRow> ebeanQuery = Ebean.find(salesPipelineRow.class);
ebeanQuery.setRawSql(rawSql);
有人能解释为什么FROM、WHERE和groupby子句被“null”取代吗
谢谢 我想这必须通过EBean邮件列表运行(如果它仍然处于活动状态,我认为EBean已经死了)。在我看来像个虫子。应呈现的SQL为:
select t0.price_min c0, t0.price_max c1, t0.event_id c2
from (
SELECT [... your raw SQL statement here ...]
) t0
limit 6
我也有同样的问题。。。你找到解决办法了吗?
Page<salesPipelineRow> page = ebeanQuery.findPagingList(5).getPage(0);
java.util.concurrent.ExecutionException: javax.persistence.PersistenceException:
Query threw SQLException:You have an error in your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near 'null t0
limit 6' at line 2
Bind values:[]
Query was:
select t0.price_min c0, t0.price_max c1, t0.event_id c2
from null t0
limit 6
select t0.price_min c0, t0.price_max c1, t0.event_id c2
from (
SELECT [... your raw SQL statement here ...]
) t0
limit 6