实体:
@Table("dim_channel_copy")
public class DimChannel {
@Column(hump = true, value = "date")
private LocalDateTime localDateTime;
...setget
}
Dao:
NutDao nutDao = new NutDao(dataSource);
DimChannel dimChannel = new DimChannel();
dimChannel.setLocalDateTime(LocalDateTime.now());
nutDao.insert(dataSource);
报错:
Exception in thread "main" org.nutz.dao.DaoException: org.nutz.castor.FailToCastObjectException: Fail to cast 'Wed Aug 18 18:27:02 CST 2021' to <long>
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:140)
at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:93)
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.EntityOperator.exec(EntityOperator.java:56)
at org.nutz.dao.impl.NutDao.insert(NutDao.java:149)
at org.myorg.quickstart.dim.DimChannel.main(DimChannel.java:72)
Caused by: org.nutz.castor.FailToCastObjectException: Fail to cast 'Wed Aug 18 18:27:02 CST 2021' to <long>
at org.nutz.castor.castor.String2Number.cast(String2Number.java:45)
at org.nutz.castor.castor.String2Number.cast(String2Number.java:19)
at org.nutz.castor.Castors.cast(Castors.java:253)
at org.nutz.castor.Castors.castTo(Castors.java:317)
at org.nutz.dao.jdbc.Jdbcs$Adaptor$7.set(Jdbcs.java:420)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:306)
at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
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.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:159)
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithoutTransaction(NutDaoRunner.java:126)
... 7 more