tags:

views:

220

answers:

2

I am using JPA in addition to spring(3.0.0.M4). While deleting multiple records using query.executeUpdate() i am getting the following exception.

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete obj com.ocimum.btree.mw.core.objecttypes.profile.entity.ProfileEntity obj]
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:648)
        org.springframework.web.servlet.FrameworkServlet.doDelete(FrameworkServlet.java:578)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I am using spring Transactional management.

Its working with entityManager.remove() but multiple delete is giving the above execption. I hav't used any query factory in application.

A: 

This has nothing to do with Spring. Your query syntax is incorrect, and the exception message is telling you that.

skaffman
A: 

DELETE [FROM] com.ocimum.btree.mw.core.objecttypes.profile.entity.ProfileEntity obj WHERE ...

Check here

Bozho