jfinal报错:调用中的无效参数

com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLIntegrityConstraintViolationException: 调用中的无效参数
at com.jfinal.plugin.activerecord.Model.save(Model.java:375)
at com.ruiya.controller.ShopManageController.regist(ShopManageController.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.jfinal.aop.Invocation.invoke(Invocation.java:71)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:74)
at com.jfinal.ext.handler.ContextPathHandler.handle(ContextPathHandler.java:47)
at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLIntegrityConstraintViolationException: 调用中的无效参数
at oracle.jdbc.driver.AutoKeyInfo.getNewSql(AutoKeyInfo.java:189)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:6679)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:512)
at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:314)
at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:509)
at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:366)
at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:447)
at com.jfinal.plugin.activerecord.Model.save(Model.java:365)
... 28 more
Caused by: java.sql.SQLException: 调用中的无效参数
at oracle.jdbc.driver.AutoKeyInfo.getReturnParamTypeCode(AutoKeyInfo.java:291)
at oracle.jdbc.driver.AutoKeyInfo.getNewSqlByColumnName(AutoKeyInfo.java:209)
at oracle.jdbc.driver.AutoKeyInfo.getNewSql(AutoKeyInfo.java:173)

... 35 more


当数据库插入一条新数据的时候

Shop_Info shop_Info = getModel(Shop_Info.class,"SHOP_INFO");
//测试把提交的信息存入数据库
shop_Info.save();

因为这个错,我调试了半天,原来是jfinal强制使用“ID”这个字断的,

解决办法:

1.在数据库中添加“ID“字断

2.java中set "ID"的值

代码如下:

Shop_Info shop_Info = getModel(Shop_Info.class,"SHOP_INFO");
shop_Info.set("ID", "2");
//测试把提交的信息存入数据库
shop_Info.save();












你可能感兴趣的:(jfinal)