Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在HQL中获取已删除的行数_Java_Hibernate_Hql - Fatal编程技术网

Java 如何在HQL中获取已删除的行数

Java 如何在HQL中获取已删除的行数,java,hibernate,hql,Java,Hibernate,Hql,我正在HQL中删除: String queryText = DELETE FROM Books WHERE author = 'author1' final Query query = getCurrentSession().createQuery(queryText); query.executeUpdate(); 如何获取查询中已删除的行数?方法executeUpdate返回已删除的实体数 因此,您将通过以下代码获得删除的行数n: int n = query.executeUpdat

我正在HQL中删除:

String queryText = DELETE FROM Books WHERE author = 'author1'

final Query query = getCurrentSession().createQuery(queryText);

query.executeUpdate();
如何获取查询中已删除的行数?

方法executeUpdate返回已删除的实体数

因此,您将通过以下代码获得删除的行数n:

 int n = query.executeUpdate();
方法executeUpdate返回已删除的实体数

因此,您将通过以下代码获得删除的行数n:

 int n = query.executeUpdate();
preparedStatement.executeUpdate返回受影响的行数

例如:

int row =preparedStatement.executeUpdate();
preparedStatement.executeUpdate返回受影响的行数

例如:

int row =preparedStatement.executeUpdate();