NutzCN Logo
问答 dao.fetch返回record的类型转换问题
发布于 2598天前 作者 qq_B961929188CCD397673F9505827728CB 3217 次浏览 复制 上一个帖子 下一个帖子
标签:
 rd=dao.fetch("users",Cnd.where("user_id", "=", uid));
				 if (rd!=null){
					  user_name=rd.getString("user_name"); 
					  headimg=rd.getString("headimg");
					  if (headimg!=null && !headimg.contains("http:/")){
							headimg="./../"+headimg;
					  } 
				 } 

其中 users表中有字段
last_time 字段类型为 datetime
默认值为:'0000-00-00 00:00:00'
当记录中last_time为'0000-00-00 00:00:00' 时,错误日志

org.nutz.dao.DaoException: Column Name=last_time, index=19
        at org.nutz.dao.entity.Record.create(Record.java:94)
        at org.nutz.dao.entity.Record.create(Record.java:57)
        at org.nutz.dao.impl.sql.pojo.PojoFetchRecordCallback.invoke(PojoFetchRecordCallback.java:16)
        at org.nutz.dao.impl.jdbc.NutPojo.onAfter(NutPojo.java:109)
        at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:233)
        at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:45)
        at org.nutz.dao.impl.DaoSupport$DaoExec.invoke(DaoSupport.java:316)
        at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:59)
        at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
        at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:271)
        at org.nutz.dao.impl.NutDao.fetch(NutDao.java:576)
        at com.ncrays.biz.controller.InvCardAction.genInvCard(InvCardAction.java:93)
        at sun.reflect.GeneratedMethodAccessor236.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
        at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
        at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
        at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
        at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
        at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
        at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Value '84#weixin_oS71IwzraGiGj5p1b1celd0Qlkz8wx_010366442@163.com     王潘王 dff601206e4c79166f79b627125c366b00
1957-01-010.000.000017720
1483432344
15077714630000-00-00 00:00:00
                             59.53.18.388671004803000000.00��2000000pc����' can not be represented as java.sql.Timestamp
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920)
        at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1101)
        at com.mysql.jdbc.BufferRow.getTimestampFast(BufferRow.java:575)
        at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:6588)
        at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6188)
        at com.alibaba.druid.pool.DruidPooledResultSet.getTimestamp(DruidPooledResultSet.java:220)
        at org.nutz.dao.entity.Record.create(Record.java:72)
        ... 46 more

3 回复

mysql驱动的bug吧

at org.nutz.dao.entity.Record.create(Record.java:94)
        at org.nutz.dao.entity.Record.create(Record.java:57)
        at org.nutz.dao.impl.sql.pojo.PojoFetchRecordCallback.invoke(PojoFetchRecordCallback.java:16)

应该不是驱动的问题 ,我找找这几行都在干嘛

添加回复
请先登陆
回到顶部