DELETE FROM Table z WHERE z.name = :name这样就可以了,呵呵。

解决方案 »

  1.   

    报这个错,老大,快帮忙
    Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
    at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:46)
    at com.ericsson.dcp.dao.impl.BatchJobDAOImpl.deleteByJobName(BatchJobDAOImpl.java:30)
    at com.ericsson.dcp.dao.impl.BatchJobDAOImpl$$FastClassByCGLIB$$974aec95.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:55)
      

  2.   

    这个已经不是 JPA 的问题了,而是你事务配置的问题
      

  3.   

    你好 jpa的批量删除怎么弄啊 急  求回复
      

  4.   

               public void delete(Serializable ... entityids) {
    for(Object id : entityids){
    em.remove(em.getReference(this.entityClass, id));
    }
    }