我正在尝试使用 JPA Criteria API 构建此查询
SELECT s FROM snapshot s
INNER JOIN (
SELECT collector_id, entity_id, MAX(timestamp) AS "timestamp"
FROM snapshot GROUP BY collector_id, entity_id
) AS j ON s.TIMESTAMP = j.TIMESTAMP AND s.collector_id = j.collector_id AND s.entity_id = j.entity_id;
Run Code Online (Sandbox Code Playgroud)
内部 select 应该获取 3 个属性来标识快照,然后外部 select 将根据内部 select 返回的 3 个属性获取快照的所有其他属性。
我成功构建了内部选择,但是如何使用连接将外部选择与内部选择结合起来?
或者,也许有一种不同的方式来构造查询本身,不包括子查询......
编辑:
我知道这已经解决了一百万次,是的,我已经搜索过,但它对我不起作用.
问题是方法super不需要正确的参数.
代码:
public class QuotesArrayAdapter extends ArrayAdapter<Map<Integer,List<String>>> {
private Context context;
Map<Integer,List<String>> Values;
static int textViewResId;
Logger Logger;
public QuotesArrayAdapter(Context context, int textViewResourceId, Map<Integer,List<String>> object) {
super(context, textViewResourceId, object); //<---- ERROR HERE
this.context = context;
this.Values = object;
Logger = new Logger(true);
Logger.l(Logger.TAG_DBG, "ArrayAdapter Inited");
}
Run Code Online (Sandbox Code Playgroud)
Eclipse说的是什么:
Multiple markers at this line
- The constructor ArrayAdapter<Map<Integer,List<String>>>(Context, int, Map<Integer,List<String>>)
is undefined
- The constructor ArrayAdapter<Map<Integer,List<String>>>(Context, int, Map<Integer,List<String>>)
is undefined
Run Code Online (Sandbox Code Playgroud)
它想要超级(Context,int),这不是我想要的