-->
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: Date Cast Convert Problem
PostPosted: Sun Mar 07, 2010 10:57 am 
Newbie

Joined: Tue Feb 02, 2010 3:38 am
Posts: 2
Hi,

When I run my below HQL, I got an HibernateQueryException.
Code:
FROM Appointment ORDER BY CAST(CONVERT(VARCHAR(10), ExtractionDateTime, 111) AS DATETIME) DESC, AppointmentDateTime ASC

Detail exception message is;
Code:
org.springframework.orm.hibernate3.HibernateQueryException: cast() requires two arguments [FROM com.poc.model.Appointment ORDER BY CAST(CONVERT(VARCHAR(10), ExtractionDateTime, 111) AS DATETIME) DESC, AppointmentDateTime ASC];

I can run the above cast-convert SQL-string in MS-SQL.
How can I write to work out in HQL.

Thanks,


Top
 Profile  
 
 Post subject: Re: Date Cast Convert Problem
PostPosted: Sun Mar 07, 2010 1:00 pm 
Newbie

Joined: Tue Feb 02, 2010 3:38 am
Posts: 2
Hi,

I have solved this the other way round.
Solution is;
Code:
ORDER BY YEAR(ExtractionTime) DESC, MONTH(ExtractionTime) DESC, DAY(ExtractionTime) DESC, AppointmentDateTime ASC


Regards,


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.