2

有以下java代码:

EntityTransaction myTransaction = myManager.getTransaction();
myTransaction.begin();
System.out.println(myManager.createQuery("delete from UserProfile where id > 16787504").executeUpdate());
myTransaction.commit();

运行后出现错误:

javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not insert/select ids for bulk delete
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
    at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:60)

有什么解决办法吗?

4

0 回答 0