Thanks for the reply. I tried using this in Hibernate2 but it didn't work. I will try to upgrade toHibernate 3 and see if it works.
Thanks, Pankaj --- Luiz Fernando Rodrigues <[EMAIL PROTECTED]> wrote: > I'm not sure about hibernate 2, but in 3 if > startDate is from the type > Date you can use modifiers such as day(), month(), > year(), minute(), > etc... > > http://www.hibernate.org/hib_docs/v3/reference/en/html/queryhql.html#queryhql-expressions > > so: > > SUM(minute(te.endDate-te.startDate))*60*24 ) is an > example that should work. > > Luiz > > On 12/5/06, pankaj singla <[EMAIL PROTECTED]> > wrote: > > Hi, > > > > Could someone help me with how to subtract > dates > > in hibernate. I am using Appfuse 1.7 wiht > hibernate 2. > > When I try this as a simple sql query in Oracle9i, > > this runs fine but hibernate it is giving me this > > error (here endDate and startDate are Dates): > > > > , expected in SELECT [Select > te.endDate-te.startDate > > from gov.chi.oemc.model.TmaEvent te > > where te.tmaEventKey='2871'] > > > > What I would eventually like to run is something > like: > > select sum((te.endDate-te.startDate)*60*24 ) > > from gov.chi.oemc.model.Tma > > > > for all the eventkeys. > > > > Thanks for your help and time. > > > > Pankaj > > > > > > > > > ____________________________________________________________________________________ > > Need a quick answer? Get one in minutes from > people who know. > > Ask your question on www.Answers.yahoo.com > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > ____________________________________________________________________________________ Any questions? Get answers on any topic at www.Answers.yahoo.com. Try it now. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
