Discussion:
GORM Bulk updates = Not supported for DML operations ?
BluSynergy
2010-02-12 18:05:34 UTC
Permalink
I'm trying to do a bulk update so that I avoid the performance hit of
retrieving each object and performing the individual update. The syntax
seems to be in line with what hibernate is calling for per this link:
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html#batch-direct

Yet I get this exception:
org.springframework.orm.hibernate3.HibernateQueryException: Not supported
for DML operations; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [update com.blusynergy.blubilling.customer.BasePaymentMethod set
autopayPreference = autopayPreference - 1 where org=? and customer=? and
autopayPreference > ?]

The actual code is:
BasePaymentMethod.executeQuery('update BasePaymentMethod set
autopayPreference = autopayPreference - 1 where org=? and customer=? and
autopayPreference > ?', [org, customer, prefNo])

Is this not supported in Grails 1.1.1.?
--
View this message in context: http://n4.nabble.com/GORM-Bulk-updates-Not-supported-for-DML-operations-tp1480764p1480764.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Burt Beckwith
2010-02-12 18:09:02 UTC
Permalink
Use executeUpdate instead of executeQuery.

Burt
Post by BluSynergy
I'm trying to do a bulk update so that I avoid the performance hit of
retrieving each object and performing the individual update. The syntax
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html#batch-direct
org.springframework.orm.hibernate3.HibernateQueryException: Not supported
for DML operations; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [update com.blusynergy.blubilling.customer.BasePaymentMethod set
autopayPreference = autopayPreference - 1 where org=? and customer=? and
autopayPreference > ?]
BasePaymentMethod.executeQuery('update BasePaymentMethod set
autopayPreference = autopayPreference - 1 where org=? and customer=? and
autopayPreference > ?', [org, customer, prefNo])
Is this not supported in Grails 1.1.1.?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
BluSynergy
2010-02-12 19:28:18 UTC
Permalink
Works like a charm, thanks Burt.

I guess executeQuery is not the "supermethod" for arbitrary HQL. So deletes
work with executeQuery, but updates specifically require executeUpdate. Got
it.
--
View this message in context: http://n4.nabble.com/GORM-Bulk-updates-Not-supported-for-DML-operations-tp1480764p1488343.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Loading...