【问题标题】:Eclipselink aggregate and constructor issueEclipselink 聚合和构造函数问题
【发布时间】:2012-11-17 10:00:25
【问题描述】:

我正在使用 Eclipselink 2.2.1.v20110722-r9776

我有以下疑问:

TypedQuery<FundMasterDTO> secQuery = em.createQuery("SELECT new com.dto.FundMasterDTO("+" sum(appAmount), sum(redemptionPrice) from security", FundMasterDTO.class);

我收到以下错误:

Exception Description: Syntax error parsing the query [SELECT new com.dto.FundMasterDTO( sum(app_amount), sum(redemption_price) from security], line 1, column 80: syntax error at [from].

Internal Exception: MissingTokenException(inserted [@-1,0:0='<missing RIGHT_ROUND_BRACKET>',<84>,1:80] at from); nested exception is java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 

如果我不使用聚合函数 SUM,那么一切正常。如果我删除构造函数,那么我会得到一个列表。

【问题讨论】:

    标签: eclipselink aggregate jpql


    【解决方案1】:

    如消息所述,您缺少右圆括号:

    SELECT new com.dto.FundMasterDTO( sum(app_amount), sum(redemption_price)) ...
                                                    two parentheses here ---^
    

    【讨论】:

      猜你喜欢
      • 2017-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多