In mysql, DELETE FROM table is much more expensive than TRUNCATE TABLE table
I believe that JPA’s Entity.deleteAll() runs delete. What’s the correct way to truncate instead?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
TRUNCATE TABLE tableis not standard-SQL, so not generally supported. To do it, execute the query directly:em().createNativeQuery("truncate table MyTable").executeUpdate();While in a Play Model class (where you have access to the
EntityManagerwithem().