Hibernate Criteria 中的行乘法

row multiplication in Hibernate Criteria

如何使用 Hibernate Criteria API 实现以下 SQL 查询:

SELECT
    SUM(field1) as s,
    SUM(field1 * field2) as m
FROM 
    table

尝试

add(Projections.sqlProjection("sum(field1)) AS s", new String[] { "s" }, new Type[] {Hibernate.DOUBLE }))
add(Projections.sqlProjection("sum(field1*field2) AS m", new String[] { "m" }, new Type[] {Hibernate.DOUBLE }))