使用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
年底项目验收,一直没时间看了,后来调试了下,之前用到了druid的WallFilter,把这个关掉就没问题了,有时间了再看看吧
WallFilterwall=newWallFilter();wall.setDbType("Oracle");druid.addFilter(wall);版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。