Record set 里面是日期的时候保存数据库报数据类型不对

Record set 里面是日期的时候保存数据库报数据类型不对

数据库是orcle 

数据类型是 date


评论区

lyh061619

2018-04-09 11:47

把错误问题贴出来瞧瞧,现在这么描述不太好看出哪出问题着。

jflyx

2018-04-09 11:59

@lyh061619 现在基本解决
和这个问题一样
六月 26, 2017 5:21:49 下午 com.sun.xml.internal.ws.server.sei.EndpointMethodHandler invoke
严重: java.sql.SQLException: 无效的列类型
com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLException: 无效的列类型
at com.jfinal.plugin.activerecord.Model.save(Model.java:413)
at com.wlkj.cxf.db.DbImpl.receivePrizeNew(DbImpl.java:7015)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.xml.internal.ws.api.server.MethodUtil.invoke(MethodUtil.java:68)
at com.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:235)
at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(InvokerTube.java:135)
at com.sun.xml.internal.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:246)
at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:85)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:299)
at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:593)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:95)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:80)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:677)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:649)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: 无效的列类型
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:9168)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8749)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:9471)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:9454)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.setObject(DruidPooledPreparedStatement.java:431)
at com.jfinal.plugin.activerecord.dialect.OracleDialect.fillStatement(OracleDialect.java:220)
at com.jfinal.plugin.activerecord.Model.save(Model.java:407)
... 36 more

加了这个new java.sql.Timestamp(new date().getTime())
可以保存,但是有时好没有保存到时间,有时有,这个然后弄好

jflyx

2018-04-09 12:01

@lyh061619 但是有时候没有保存到时间,只保存到年月日,但有时又有时间,这个什么问题?

JFinal

2018-04-09 12:16

@jflyx jfinal 3.4 对 oracle、sql server 等数据库的 "日期"、"时间" 类的类型做了全面增强,建议用上 jfinal 3.4,由于 jfinal 3.4 还未正式发布,可以使用这个贴子中的方法先用上:
http://www.jfinal.com/share/714

过几天 3.4 正式发布以后,改个版本号即可升级

lyh061619

2018-04-09 13:35

@JFinal 波总,那么快的。

jflyx

2018-04-09 14:21

@JFinal 好的谢谢波总

热门反馈

扫码入社