如何将Lambda表达式转换为SQL字符串

时间:2019-04-27 21:34:05

标签: java java-stream speedment

我正在使用速度来从数据库访问数据。这样:

Join <Tuple2 <Customer, Orders >> join = joinComponent
     .from (Customer.IDENTIFIER)
     .innerJoinOn (Orders.O_CUSTKEY) .equal (Customer.C_CUSTKEY)
      .build (Tuples :: of);

我有这个表达式来计算“ o_custkey”:

IntSummaryStatistics dstats = join.stream().mapToInt(t->t.get1().getOCustkey().getAsInt()).summaryStatistics();
Long count = dstats.getCount();

我想将此表达式转换为表示隐式sql查询的字符串。您应该得到这样的内容: SELECT COUNT (O_CUSTKEY) FROM ORDERS, CUSTOMER WHERE O_CUSTKEY = C_CUSTKEY

我该怎么做?

0 个答案:

没有答案