NutzCN Logo
问答 Oracle数据库,数据库字段类型是 Timestamp(6),dao.query()报错,如何解决?
发布于 1597天前 作者 qq_1e13f6b2 1435 次浏览 复制 上一个帖子 下一个帖子
标签:

nutz 1.r.66,数据库 Oracle
数据库字段类型:Timestamp(6),实体类字段类型 Date

@Column("OGG_TIMESTAMP")
private Date oggTimestamp;

dao 调用

List<GpPolicyPlan> policyPlanList = dao.query(GpPolicyPlan.class, Cnd.where("POLICYNO", "=", "6310100990320160000019"));

报错信息

2020-07-02 17:07:44 [main] DEBUG org.nutz.dao.impl.sql.run.NutDaoExecutor -SELECT * FROM GPPOLICYPLAN  WHERE POLICYNO=?
    |                      1 |
    |------------------------|
    | 6310100990320160000019 |
  For example:> "SELECT * FROM GPPOLICYPLAN  WHERE POLICYNO='6310100990320160000019'"

java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]

	at java.sql.Timestamp.valueOf(Timestamp.java:204)
	at oracle.jdbc.driver.CharCommonAccessor.getTimestamp(CharCommonAccessor.java:544)
	at oracle.jdbc.driver.T4CVarcharAccessor.getTimestamp(T4CVarcharAccessor.java:933)
	at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:1376)
	at oracle.jdbc.driver.OracleResultSet.getTimestamp(OracleResultSet.java:512)
	at com.zaxxer.hikari.pool.HikariProxyResultSet.getTimestamp(HikariProxyResultSet.java)
	at org.nutz.dao.jdbc.Jdbcs$Adaptor$14.get(Jdbcs.java:572)
	at org.nutz.dao.impl.entity.field.NutMappingField.injectValue(NutMappingField.java:89)
	at org.nutz.dao.impl.entity.NutEntity.getObject(NutEntity.java:211)
	at org.nutz.dao.impl.sql.pojo.PojoQueryEntityCallback$1.createObject(PojoQueryEntityCallback.java:24)
	at org.nutz.dao.pager.ResultSetLooping.doLoop(ResultSetLooping.java:75)
	at org.nutz.dao.impl.sql.pojo.PojoQueryEntityCallback.invoke(PojoQueryEntityCallback.java:28)
	at org.nutz.dao.impl.jdbc.NutPojo.onAfter(NutPojo.java:114)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:277)
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:53)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
	at org.nutz.integration.spring.SpringDaoRunner._run(SpringDaoRunner.java:18)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:82)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
	at org.nutz.dao.impl.NutDao.query(NutDao.java:483)
	at org.nutz.dao.impl.NutDao.query(NutDao.java:488)
	at com.taikang.toolbox.datatransfer.DataTransferTest.testQueryInsert(DataTransferTest.java:100)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
	at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

如何解决啊?

2 回复

传long,不要传字符串

用来查询的是另一个字段 POLICYNO,跟那个字符串没关系啊

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