From: <no...@at...> - 2006-07-10 16:58:59
|
SYSDATE and SYSTIMESTAMP not working well with Hibernate 3.1.3 and Oracle 1= 0.2.0.1 ---------------------------------------------------------------------------= ------- Key: HHH-1893 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH= -1893 Project: Hibernate3 Type: Bug Components: query-sql =20 Versions: 3.1.3 =20 Reporter: Nestor Bosc=C3=A1n Priority: Minor Trying to use sysdate or systimestamp in SQL Queries with Oracle database.= =20 If I use sysdate Hibernate is not retrieving the hour, minute, second part.= I always get 12:00:00pm=20 If I use systimestamp I get the following exception:=20 org.hibernate.MappingException: No Dialect mapping for JDBC type: -101=20 at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)=20 at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)=20 at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)=20 at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.j= ava:161)=20 at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.= java:131)=20 at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)=20 at org.hibernate.loader.Loader.doQuery(Loader.java:662)=20 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loade= r.java:224)=20 at org.hibernate.loader.Loader.doList(Loader.java:2145)=20 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)=20 at org.hibernate.loader.Loader.list(Loader.java:2024)=20 at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)=20 at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)=20 at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142= )=20 at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)=20 at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java= :749)=20 Hibernate version: 3.1.3=20 Code between sessionFactory.openSession() and session.close():=20 Session session =3D null;=20 Date date;=20 try=20 {=20 session =3D sessionFactory.openSession ();=20 date =3D (Date) session.createSQLQuery ("SELECT SYSDATE CURRENT_DATE FROM D= UAL").uniqueResult ();=20 }=20 finally=20 {=20 try=20 {=20 if (session !=3D null) session.close ();=20 }=20 catch (HibernateException e2) {}=20 }=20 System.out.println (new SimpleDateFormat ("hh:mm:ss").format (date));=20 Name and version of the database you are using: Oracle 10.2.0.1 --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators= .jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |