Hibernate version:
2.1.7
Mapping documents:
Code:
<class name="com.argus.issueTracker.domain.vo.Issue" table="threads">
<id name="threadId" column="thread_id" type="integer">
<generator class="increment"/>
</id>
<property name="opened" column="opened" type="timestamp"/>
<property name="closed" column="closed" type="timestamp"/>
<property name="lastModified" column="last_modified" type="timestamp"/>
</class>
Code between sessionFactory.openSession() and session.close():Code:
try {
newIssue = (Issue) session.saveOrUpdateCopy(issue);
} catch (HibernateException e) {
LOG.error(e);
Full stack trace of any exception that occurs:Code:
java.lang.ClassCastException
at net.sf.hibernate.type.TimestampType.deepCopyNotNull(TimestampType.java:63)
at net.sf.hibernate.type.NullableType.deepCopy(NullableType.java:96)
at net.sf.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:212)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:935)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:866)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:788)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4062)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdateCopy(SessionImpl.java:4029)
at com.argus.issueTracker.domain.dao.IssueDAO.createIssue(IssueDAO.java:37)
Name and version of the database you are using:
MySQL
This error occurs when I try to insert a new object into the DB. I am sendign down a populated object to the method excerpt you see above.
Of the 3 Timestamp fields in the DB, all are defined as java.sql.Timestamp's in the java. The Opened field has a default-value of CURRENT-TIMESTAMP in the DB. The rest have a default of 0000-00-00 00:00:00.
I guess I just don't understand what would cause the ClassCast exception. I assume that it's recasting something underneath the hood, but I don't know what, or why?