请问怎么执行SQL语句

想执行update,insert这种SQL语句,应该使用哪个API?

可以用 EntityManager#executeUpdate,示例:

EntityManager em = persistence.getEntityManager();
em.setSoftDeletion(false);
em.createQuery("delete from erp$DemandPlan e where e.plant.id = :plantId") 
.setParameter("plantId", plant.getId()) .executeUpdate();
em.setSoftDeletion(true);