借用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)*fact
与n+(1*fact)
?
答案 0 :(得分:1)
Querydsl在序列化内部处理括号。您的表达式可以在Querydsl
中表达n.add(1).times(fact)
和
n.add(fact.times(1))