在jfinal中使用druid 向非自增主键表插入数据报错的疑问

fantasyisking 发布于 2015/02/03 16:34
阅读 808
收藏 0

使用model的save方法插入数据,oracle的表主键没有使用序列,是自己创建的主键save前set进去的,在插入成功后会调用 getGeneratedKey(pst, table);继而进入到druid的具体实现中,奇怪的是使用druid的0.2.25没有问题,但是使用1.0.12会报错,不知道是什么原因,还请 大家帮忙,报错信息如下:

Caused by: java.sql.SQLException: Error
    at com.alibaba.druid.pool.DruidDataSource.handleConnectionException(DruidDataSource.java:1195) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.pool.DruidPooledConnection.handleException(DruidPooledConnection.java:127) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.pool.DruidPooledStatement.checkException(DruidPooledStatement.java:68) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.pool.DruidPooledStatement.getGeneratedKeys(DruidPooledStatement.java:607) ~[druid-1.0.12.jar:1.0.12]
    at com.jfinal.plugin.activerecord.Model.getGeneratedKey(Model.java:336) ~[jfinal-1.9.jar:na]
    at com.jfinal.plugin.activerecord.Model.save(Model.java:320) ~[jfinal-1.9.jar:na]
    ... 54 common frames omitted
Caused by: java.lang.NullPointerException: null
    at oracle.jdbc.driver.AutoKeyInfo.initMetaDataColumnIndexes(AutoKeyInfo.java:423) ~[ojdbc7-12.1.0.2.jar:12.1.0.1.0]
    at oracle.jdbc.driver.AutoKeyInfo.initMetaData(AutoKeyInfo.java:396) ~[ojdbc7-12.1.0.2.jar:12.1.0.1.0]
    at oracle.jdbc.driver.OracleReturnResultSet.getMetaData(OracleReturnResultSet.java:77) ~[ojdbc7-12.1.0.2.jar:12.1.0.1.0]
    at com.alibaba.druid.wall.WallFilter.preprocessResultSet(WallFilter.java:1381) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.wall.WallFilter.statement_getGeneratedKeys(WallFilter.java:643) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.filter.FilterChainImpl.statement_getGeneratedKeys(FilterChainImpl.java:2618) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.filter.FilterAdapter.statement_getGeneratedKeys(FilterAdapter.java:2524) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.filter.FilterEventAdapter.statement_getGeneratedKeys(FilterEventAdapter.java:415) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.filter.FilterChainImpl.statement_getGeneratedKeys(FilterChainImpl.java:2618) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.proxy.jdbc.StatementProxyImpl.getGeneratedKeys(StatementProxyImpl.java:299) ~[druid-1.0.12.jar:1.0.12]
    at com.alibaba.druid.pool.DruidPooledStatement.getGeneratedKeys(DruidPooledStatement.java:599) ~[druid-1.0.12.jar:1.0.12]
    ... 56 common frames omitted

加载中
1
fantasyisking
fantasyisking

年底项目验收,一直没时间看了,后来调试了下,之前用到了druid的WallFilter,把这个关掉就没问题了,有时间了再看看吧

WallFilter wall = new WallFilter();
wall.setDbType("Oracle");
druid.addFilter(wall);




0
JFinal
JFinal
将数据源切换到 c3p0 试试, 以上异常信息无法判断是什么错误
返回顶部
顶部