From: Max R. A. (JIRA) <no...@at...> - 2006-07-11 19:19:57
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1893?pa= ge=3Dcomments#action_23603 ]=20 Max Rydahl Andersen commented on HHH-1893: ------------------------------------------ The solution and workaround *has* still been documented and you forgot to r= ead the part of us telling you to use the forum to discuss this. Oracle is apparently returning DATE as type where it should return TIMESTAM= P. I kindly ask you (again) to go to the user forum if you want to keep discus= sing oracle fun or=20 If you think you have a better (and correct) solution then patches are welc= ome. QED > SYSDATE and SYSTIMESTAMP not working well with Hibernate 3.1.3 and Oracle= 10.2.0.1 > -------------------------------------------------------------------------= --------- > > Key: HHH-1893 > URL: http://opensource.atlassian.com/projects/hibernate/browse/H= HH-1893 > Project: Hibernate3 > Type: Bug > Components: query-sql > Versions: 3.1.3 > 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 par= t. 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= .java:161)=20 > at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoade= r.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(Loa= der.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:1= 42)=20 > at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)=20 > at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.ja= va: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= DUAL").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 |