NutzCN Logo
问答 数据库版本不支持SavePoint,NutzDao抛异常怎么办?
发布于 2059天前 作者 qq_298f8d38 2054 次浏览 复制 上一个帖子 下一个帖子
标签:

数据库版本不支持SavePoint,用原始JDBC可以连接也能查数据,用NutzDao就抛异常了,请问有没有办法把SavePoint关了?

Exception in thread "pool-2-thread-1" org.nutz.dao.DaoException: org.postgresql.util.PSQLException: ERROR: SAVEPOINT is not yet supported.
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:116)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:89)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:75)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:73)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:236)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:1008)
	at com.skynet.ObjectStore.importTool.Jdbc2ObjectStore.readAll(Jdbc2ObjectStore.java:164)
	at com.skynet.ObjectStore.importTool.Jdbc2ObjectStore.access$500(Jdbc2ObjectStore.java:34)
	at com.skynet.ObjectStore.importTool.Jdbc2ObjectStore$2.run(Jdbc2ObjectStore.java:351)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.postgresql.util.PSQLException: ERROR: SAVEPOINT is not yet supported.
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
	at org.postgresql.jdbc.PgStatement.executeUpdate(PgStatement.java:244)
	at org.postgresql.jdbc.PgConnection.setSavepoint(PgConnection.java:1627)
	at com.alibaba.druid.pool.DruidPooledConnection.setSavepoint(DruidPooledConnection.java:1011)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:103)
	... 14 more

5 回复

是数据库驱动不支持还是数据库本身不支持?

可以考虑继承NutDaoRunner,改造一下

能否明示一下NutDaoRunner如何改造?
是数据库不支持,用的腾讯的TBASE,V1版不支持SavePoint。

覆盖_runWithTransaction方法, 里面调用_runWithoutTransaction

然后给NutDao调用setRunner

添加回复
请先登陆
回到顶部