Java type for date/time when using Oracle Date with Hibernate

Posted by Marcus on Stack Overflow See other posts from Stack Overflow or by Marcus
Published on 2010-02-03T00:12:18Z Indexed on 2010/05/01 0:47 UTC
Read the original article Hit count: 472

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about Oracle