Why this hibernate template bulkUpdate doesn't work

前端 未结 1 1274
走了就别回头了
走了就别回头了 2020-12-20 21:34

Oracle 10g, Hibernate 3.4

This update (based on long user.userId value) is done correctly:

getHibernateTemplate().bulkUpdate(\"update Ad         


        
相关标签:
1条回答
  • 2020-12-20 22:12

    Hibernate documentation says:

    • No joins, 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.

    So, you need to replace implicit join with the equivalent subquery:

    getHibernateTemplate().bulkUpdate(
       "update Address address set address.preferred = 1 " +
       "where address.user in (select u from User u where u.language = ?)",
       "en"); 
    
    0 讨论(0)
提交回复
热议问题