如何在QueryDSL中指定括号?

时间:2014-10-06 05:08:30

标签: querydsl

借用http://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL#Common_table_expression中的示例:

WITH RECURSIVE temp (n, fact) AS 
(SELECT 0, 1 -- Initial Subquery
  UNION ALL 
 SELECT n+1, (n+1)*fact FROM temp -- Recursive Subquery 
        WHERE n < 9)
SELECT * FROM temp;

如何使用QueryDSL在SELECT子句中表达(n+1)*factn+(1*fact)

1 个答案:

答案 0 :(得分:1)

Querydsl在序列化内部处理括号。您的表达式可以在Querydsl

中表达
n.add(1).times(fact)

n.add(fact.times(1))