-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Oracle date subtraction in HQL
PostPosted: Tue Jun 28, 2005 6:24 pm 
Newbie

Joined: Thu Oct 07, 2004 9:20 am
Posts: 11
Hibernate version: 2.1.8
Name and version of the database you are using:Oracle 8i

Oracle allows subtracting two dates, it returns a floating point number which represents the days (and fractions of a day) between the two dates.

I can't convince Hibernate 2.1.8 to pass the date subtraction through to oracle. Is it possible? Is it possible in Hibernate3?

Here is a very simple example:
Code:
SELECT hg.closedDate-hg.createdDate FROM TicketStats hg


And the ensuing traceback:
Code:

Caused by: net.sf.hibernate.QueryException: , expected in SELECT [SELECT hg.closedDate-hg.createdDate FROM com.verisign.mss.storage.TicketStats hg]
   at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:169)
   at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
   at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114)
   at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143)
   at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
   at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
   at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
   at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:295)
   at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1571)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1542)
   at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
   at com.verisign.mss.storage.hibernate.StatsHgramRowBasedHDAO.getCountsOverTime(StatsHgramRowBasedHDAO.java:158)
   ... 14 more


Top
 Profile  
 
 Post subject: Problem resolved in 3.1.2
PostPosted: Mon Mar 06, 2006 9:54 am 
Newbie

Joined: Thu Oct 07, 2004 9:20 am
Posts: 11
Date subtraction works in 3.1.2.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.