从Jfinal2.0升级到2.2遇到的Tx.class的问题!

会哭的鳄鱼 发布于 2016/08/13 18:14
阅读 339
收藏 0

@JFinal ,我从2.0升级到2.2,以前2.0的时候,都是在方法前面加个注解,增加Tx.class,代码如下:

升级到2.2下,就报那个错误:

com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLException: 仅 READ_COMMITTED 和 SERIALIZABLE 是有效的事务处理级

at com.jfinal.plugin.activerecord.tx.Tx.intercept(Tx.java:84)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.zp.interceptor.AccessAdminInterceptor.intercept(AccessAdminInterceptor.java:17)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.zp.interceptor.DirectiveInterceptor.intercept(DirectiveInterceptor.java:20)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.zp.interceptor.ContextInterceptor.intercept(ContextInterceptor.java:43)

at com.jfinal.aop.Invocation.invoke(Invocation.java:67)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:74)

at com.zp.handler.BaseHandler.handle(BaseHandler.java:20)

at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)

at org.eclipse.jetty.server.Server.handle(Server.java:365)

at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)

at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)

at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)

at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)

at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)

at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

at java.lang.Thread.run(Thread.java:619)

加载中
0
JFinal
JFinal

   错误提示你的数据库不支持事务级别为 Connection.TRANSACTION_REPEATABLE_READ,设置为 Connection.TRANSACTION_READ_COMMITTED 或者  Connection.TRANSACTION_SERIALIZABLE 即可,设置方式为:

ActiveRecordPlugin arp = new ActiveRecordPlugin(...);
arp.setTransactionLevel(Connection.TRANSACTION_READ_COMMITTED);
me.add(arp);

   一般来说是 Oracle 不支持这个事务级别,没碰到过 mysql 不支持这个的

0
会哭的鳄鱼
会哭的鳄鱼
我把级别设置成2就可以了。
0
会哭的鳄鱼
会哭的鳄鱼
看来还是oracle的问题。希望下次更新的时候自动判断如果是oracle,就把级别设置为2。
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部