I am executing the query in HQL for which i am getting the below error. I am using DB2 as database,
Error: Caused by: org.hibernate.queryexception: in expected [hql query]
and query is,
final String qStr = "select distinct a.* from (select attr.* from AttributeModel attr, BOModel bo, BusinessIdentifierModel ident, NameTransferModel name, NameTransferModel name2 WHERE" +
"bo.businessIdentifierId = ident.businessIdentifierId AND" +
"ident.businessIdentifier = :businessIdentifier AND" +
"attr.compAttributeModelKey.boRowNo = bo.compBOModelKey.boRowNo AND" +
"attr.compAttributeModelKey.eventId = bo.compBOModelKey.eventId AND" +
"bo.typeId = name.nameTransferId AND" +
"name.originalName = :className AND" +
"bo.nameId = name2.nameTransferId AND" +
"name2.originalName = :fieldName) a JOIN (SELECT event.eventId, attr2.nameTransferId, attr2.compAttributeModelKey.boRowNo, RANK() OVER (PARTITION BY bo2.businessIdentifierId, attr2.nameTransferId, attr2.compAttributeModelKey.boRowNo ORDER BY event.eventId desc ) rank from EventModel event, BOModel bo2, AttributeModel attr2,BusinessIdentifierModel ident WHERE" +
"event.changeTime <= :time AND" +
"bo2.businessIdentifierId = ident.businessIdentifierId AND"+
"bo2.compBOModelKey.eventId = event.eventId AND" +
"attr2.compAttributeModelKey.eventId = event.eventId AND" +
"attr2.compAttributeModelKey.boRowNo = bo2.compBOModelKey.boRowNo AND" +
"ident.businessIdentifier = :businessIdentifier) b ON (" +
"a.eventId = b.eventId AND" +
"a.nameTransferId = b.nameTransferId AND" +
"a.boRowNo = b.boRowNo AND" +
"RANK = '1')";
Please have a glance and suggest me if any wrong syntax
The (first) error is actually in the message...
Error: Caused by: org.hibernate.queryexception: **in** expected [hql query]
An IN is expected.
I don't really understand your join. Your JOIN on the second subselect, is that supposed to be where IN?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.