Java type for date/time when using Oracle Date with Hibernate
- by Marcus
We have a Oracle Date column. At first in our Java/Hibernate class we were using java.sql.Date. This worked but it didn't seem to store any time information in the database when we save so I changed the Java data type to Timestamp. Now we get this error:
springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.dao.an
notation.PersistenceExceptionTranslationPostProcessor#0'
defined in class path resource
[margin-service-domain
-config.xml]: Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreatio
nException: Error creating bean with
name 'sessionFactory' defined in class
path resource [m-service-doma
in-config.xml]: Invocation of init
method failed; nested exception is
org.hibernate.HibernateException:
Wrong column type: CREATE_TS,
expected: timestamp
Any ideas on how to map an Oracle Date while retaining the time portion?
Update: I can get it to work if I use the Oracle Timestamp data type but I don't want that level of precision ideally. Just want the basic Oracle Date.