Discussion:
Gorm ExecuteQuery for Delete not working
MarkAtHarvest
2009-01-13 15:05:24 UTC
Permalink
I am trying to delete all records in a table, but execute query throws me an
exception
89: Emp.executeQuery('delete from Emp')

It this works, I want to have a query something like
Emp.executeQuery('delete e from Emp where e.name like $empName" ')

Thanks in Advance
+++++++++++
Following is the exception I am getting
Error 200: org.springframework.orm.hibernate3.HibernateQueryException: Not
supported for DML operations [delete from Emp]; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [delete from Emp]
Servlet: grails
URI: /sample/grails/emp/refresh.dispatch
Exception Message: Not supported for DML operations [delete from Emp];
nested exception is org.hibernate.hql.QueryExecutionRequestException: Not
supported for DML operations [delete from Emp]
Caused by: org.springframework.orm.hibernate3.HibernateQueryException: Not
supported for DML operations [delete from Emp]; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [delete from Emp]
Class: EmpService
--
View this message in context: http://www.nabble.com/Gorm-ExecuteQuery-for-Delete-not-working-tp21437502p21437502.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
2009-01-13 15:06:51 UTC
Permalink
executeQuery is for selects, you need to run executeUpdate.
--
Burt
Post by MarkAtHarvest
I am trying to delete all records in a table, but execute query throws me an
exception
89: Emp.executeQuery('delete from Emp')
It this works, I want to have a query something like
Emp.executeQuery('delete e from Emp where e.name like $empName" ')
Thanks in Advance
+++++++++++
Following is the exception I am getting
Error 200: org.springframework.orm.hibernate3.HibernateQueryException: Not
supported for DML operations [delete from Emp]; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [delete from Emp]
Servlet: grails
URI: /sample/grails/emp/refresh.dispatch
Exception Message: Not supported for DML operations [delete from Emp];
nested exception is org.hibernate.hql.QueryExecutionRequestException: Not
supported for DML operations [delete from Emp]
Caused by: org.springframework.orm.hibernate3.HibernateQueryException: Not
supported for DML operations [delete from Emp]; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [delete from Emp]
Class: EmpService
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
MarkAtHarvest
2009-01-13 16:49:47 UTC
Permalink
Yes, that works great as expected, only the thing is, is there a way we can
flush it, as I am populating right after it and still getting the Unique key
errors.
Post by Burt Beckwith
executeQuery is for selects, you need to run executeUpdate.
--
Burt
Post by MarkAtHarvest
I am trying to delete all records in a table, but execute query throws me an
exception
89: Emp.executeQuery('delete from Emp')
It this works, I want to have a query something like
Emp.executeQuery('delete e from Emp where e.name like $empName" ')
Thanks in Advance
+++++++++++
Following is the exception I am getting
Error 200: org.springframework.orm.hibernate3.HibernateQueryException: Not
supported for DML operations [delete from Emp]; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [delete from Emp]
Servlet: grails
URI: /sample/grails/emp/refresh.dispatch
Exception Message: Not supported for DML operations [delete from Emp];
nested exception is org.hibernate.hql.QueryExecutionRequestException: Not
supported for DML operations [delete from Emp]
Caused by: org.springframework.orm.hibernate3.HibernateQueryException: Not
supported for DML operations [delete from Emp]; nested exception is
org.hibernate.hql.QueryExecutionRequestException: Not supported for DML
operations [delete from Emp]
Class: EmpService
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
--
View this message in context: http://www.nabble.com/Gorm-ExecuteQuery-for-Delete-not-working-tp21437502p21439655.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...