Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 mysql 中,DELETE FROM table比TRUNCATE TABLE table
DELETE FROM table
TRUNCATE TABLE table
我相信 JPA 的Entity.deleteAll()运行删除。截断的正确方法是什么?
Entity.deleteAll()
TRUNCATE TABLE table不是标准 SQL,因此一般不支持。为此,请直接执行查询:
em().createNativeQuery("truncate table MyTable").executeUpdate();
在 Play Model 类中(您可以在其中访问EntityManagerwith em().
EntityManager
em()