Hibernate 在Oracle CCB实用程序框架中使用SELECT子句时出现HQL查询异常

Hibernate 在Oracle CCB实用程序框架中使用SELECT子句时出现HQL查询异常,hibernate,oracle-ccb,Hibernate,Oracle Ccb,我在hql Oracle CC&B实用程序框架中遇到了一个问题 我的SQL查询是 select msg.EXT_MSG_ID, msg.MKTMSG_ID from O2_IN_CA_MSG msg where EXT_MSG_ID = (select to_char(max(to_number(msg1.EXT_MSG_ID))) from O2_IN_CA_MSG msg1, F1_BUS_OBJ_STATUS bostatus

我在hql Oracle CC&B实用程序框架中遇到了一个问题

我的SQL查询是

select msg.EXT_MSG_ID, msg.MKTMSG_ID
from  O2_IN_CA_MSG msg
where EXT_MSG_ID = (select to_char(max(to_number(msg1.EXT_MSG_ID)))
                          from O2_IN_CA_MSG msg1, F1_BUS_OBJ_STATUS bostatus 
                          where msg1.BUS_OBJ_CD = bostatus.BUS_OBJ_CD 
                                AND bostatus.BO_STATUS_COND_FLG <> 'F1FL' 
                                AND msg1.BO_STATUS_CD = bostatus.BO_STATUS_CD 
                                AND msg1.BUS_OBJ_CD = 'O2-OESPCusTarIn'
                                AND msg1.SRC_DOC_ID = '12345678' 
                                AND msg1.MKTMSG_ID <> '179977027857'
                                AND msg1.acct_id = '7565333022'
                  )
HQL查询1:

FROM InboundCustomerAdminMessage inboundCustomerAdminMessage
WHERE inboundCustomerAdminMessage.externalMessageId = 
    (TO_CHAR(MAX(TO_NUMBER(inboundCustomerAdminMessage1.externalMessageId))) 
    FROM InboundCustomerAdminMessage inboundCustomerAdminMessage1, BusinessObjectStatus businessObjectStatus 
    WHERE inboundCustomerAdminMessage1.businessObject.id = businessObjectStatus.id.businessObject.id 
    AND businessObjectStatus.condition <> :boStatusCond 
    AND inboundCustomerAdminMessage1.status = businessObjectStatus.id.status 
    AND businessObjectStatus.id.businessObject.id = :businessObjectId 
    AND inboundCustomerAdminMessage1.sourceDocumentId = :srcDocId 
    AND inboundCustomerAdminMessage1.id <> :mktMsgId )
例外情况是:ORA-00934:此处不允许使用组函数

我尝试使用SELECT进行第二次查询 HQL查询2:

FROM InboundCustomerAdminMessage inboundCustomerAdminMessage
WHERE inboundCustomerAdminMessage.externalMessageId = 
    (SELECT TO_CHAR(MAX(TO_NUMBER(inboundCustomerAdminMessage1.externalMessageId))) 
    FROM InboundCustomerAdminMessage inboundCustomerAdminMessage1, BusinessObjectStatus businessObjectStatus 
    WHERE inboundCustomerAdminMessage1.businessObject.id = businessObjectStatus.id.businessObject.id 
    AND businessObjectStatus.condition <> :boStatusCond 
    AND inboundCustomerAdminMessage1.status = businessObjectStatus.id.status 
    AND businessObjectStatus.id.businessObject.id = :businessObjectId 
    AND inboundCustomerAdminMessage1.sourceDocumentId = :srcDocId 
    AND inboundCustomerAdminMessage1.id <> :mktMsgId )
这次例外情况是: 从InboundCustomerAdminMessage InboundCustomerAdminMessage创建hibernate查询“时出错,其中InboundCustomerAdminMessage.externalMessageId=all select TO_CHARMAXTO_NUMBERinboundCustomerAdminMessage1.externalMessageId来自InboundCustomerAdminMessage inboundCustomerAdminMessage1,BusinessObjectStatus BusinessObjectStatus其中inboundCustomerAdminMessage1.businessObject.id=BusinessObjectStatus.id.businessObject.id和BusinessObjectStatus.condition:boStatusCond和inboundCustomerAdminMessage1.status=BusinessObjectStatus.id.status和BusinessObjectStatus.id.businessObject.id=:businessObjectId和inboundCustomerAdminMessage1.sourceDocumentId=:srcDocId和inboundCustomerAdminMessage1.id:mktMsgId'

org.hibernate.QueryException:在选择之前应为[从com.splwg.domain.mtm.inbound.inboundCustomerAdminMessage.inboundCustomerAdminMessage\uuuuuuu\uboundCustomerAdminMessage\uuuuuuuuuu\uboundCustomerAdminMessage中选择inboundCustomerAdminMessage.externalMessageId=全部从com.splwg.domain.mtm.inbound.inboundC中选择CHARMAXTO\uNumberInboundCustomerAdminMessage1.externalMessageIdCustomerAdminMessage.InboundCustomerAdminMessage\InboundCustomerAdminMessage\InboundCustomerAdminMessage,com.splwg.domain.common.businessObject.BusinessObjectStatus\inboundCustomerAdminMessage1.businessObject.id=BusinessObjectStatus.id.businessObject.id和BusinessObjectStatus.condition:boStatusCond和inboundCustomerAdminMessage1.status=businessObjectStatus.id.status和businessObjectStatus.id.businessObject.id=:businessObjectId和inboundCustomerAdminMessage1.sourceDocumentId=:srcDocId和inboundCustomerAdminMessage1.id:mktMsgId按inboundCustomerAdminMessage排序。externalMessageId desc]


您能否帮助任何人了解如何在hql中使用SELECT子句。

在hql中按inboundCustomerAdminMessage.externalMessageId desc删除订单