I am working on a grails project. I have following query that I am trying to execute
String CHECK_FOR_HIGH_TRADE_VOLUME_QUERY = \"Update LocationTrade lt set lt.
The Hibernate documentation says:
No join, either implicit or explicit, can be specified in a bulk HQL query. Sub-queries can be used in the where-clause, where the subqueries themselves may contain joins.
lt.trade.volume
is an implicit inner join between LocationTrade and Trade, so the query is invalid. You'll have to rewrite it to something like the following:
update LocationTrade lt set lt.hasVeryHighVolume=true where lt.locationIndices=?
and lt.id in (
select lt2.id from LocationTrade lt2 where lt2.trade.volume > 20000)
Or you'll have to use a SQL query instead.