hibernate and delete all

前端 未结 3 1536
悲&欢浪女
悲&欢浪女 2021-02-01 02:31

What is the best way to delete all rows in a table in Hibernate?

If I iterate over a collection and call session.delete() it\'s not perform

3条回答
  •  一个人的身影
    2021-02-01 03:29

    String stringQuery = "DELETE FROM tablename";
    Query query = session.createQuery(stringQuery);
    query.executeUpdate();
    

提交回复
热议问题