ava.lang.String cannot be cast to java.util.Date 一个小小的异常,兄弟姐妹们来我这
public class AppLog {
private Date recordtime;//登录时间
.
.
.
public Date getRecordtime() {
return recordtime;
}
public void setRecordtime(Date recordtime) {
this.recordtime = recordtime;
}
}
test.java:34-----------------> appLog.setRecordtime(new Date());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hibernate: insert into t_loginlog (Fd_time, Fd_checkoutTime, Fc_ip, Fc_appname, Fc_loginname, Fc_username, Fc_compname, Fc_result, Fc_note) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
Exception in thread "main " java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
at org.hibernate.type.DateType.deepCopyNotNull(DateType.java:82)
at org.hibernate.type.MutableType.deepCopy(MutableType.java:25)
at org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:374)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:280)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:693)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:690)
at com.inspur.systemlog.dao.SystemLogDaoImpl.addAppLog(SystemLogDaoImpl.java:25)
at