Postgresql-7.3.1版本中遇到的trncate有关问题

Postgresql-7.3.1版本中遇到的trncate有关问题

Postgresql-7.3.1版本中遇到的trncate问题!

Hibernate中使用truncate   tasble,代码如下:

public   Object   doInHibernate(Session   session)

              throws   HibernateException,   SQLException   {

          session.createSQLQuery( “truncate   table   customers “).executeUpdate();

                }

使用postgresql-7.3.1版本的数据库报错:

Exception   in   thread   “timerFactory ”   org.springframework.jdbc.UncategorizedSQLException:   Hibernate   operation:   could   not   execute   native   bulk   manipulation   query;   uncategorized   SQLException   for   SQL   [truncate   table   tbl_easynet_alert_info];   SQL   state   [];   error   code   [0];   ERROR:     TRUNCATE   TABLE   cannot   run   inside   a   transaction   block;   nested   exception   is   org.postgresql.util.PSQLException:   ERROR:     TRUNCATE   TABLE   cannot   run   inside   a   transaction   block

Caused   by:   org.postgresql.util.PSQLException:   ERROR:     TRUNCATE   TABLE   cannot   run   inside   a   transaction   block

但是使用postgresql-8.3版本的数据,可以正常运行不会报错,这是什么原因,有没有什么解决办法啊,求助求助!!!



估计是1个限制,在7.3.1中事务块内不能运行TRUNCATE TABLE ,只有升级




改成delete from customers

Postgresql-7.3.1版本中遇到的trncate有关问题

相关文章:

你感兴趣的文章:

标签云: