(1)drop table 表名 是删除表数据,同时删除表,即在数据库中再没有这张表
(2)truncate table 表名删除表数据,同时释放表空间,新数据的id从1开始
(3)delete table 表名 只是删除数据,但不释放表空间,新建的id=之前的id+1
以及hibernate 的truncate 报错could not execute native bulk manipulation query
而且hibernate是执行原生的sql语句,下面是执行代码
//Action中
newKhmbflService.excudeSqlUpdate("truncate table kh_mbfl");
//BaseDaoImpl 中的代码
Query query=getCSession().createSQLQuery(sql);
return query.executeUpdate();
这样写应该是没有问题,应为kh_mbfl是主表,会级联删除好多表数据,但是用delete 原生执行也不行,只有在执行Hql 语句"delete KhMbfl" 执行是成功的。