Is there an efficient way to truncate a specific table via data manager? The correlating SQL would be: DELETE FROM mytable or TRUNCATE TABLE mytable;
Hi,
You can use EntityManager to run native SQL queries, e.g.:
@Component
public class TruncateService {
@PersistenceContext
private EntityManager entityManager;
@Transactional
public void truncateTest() {
entityManager.createNativeQuery("TRUNCATE TABLE TEST").executeUpdate();
}
}
Regards,
Gleb