-->
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.  [ 1 post ] 
Author Message
 Post subject: Help Required in using nested database functions
PostPosted: Wed Jul 13, 2005 7:19 am 
Newbie

Joined: Wed Jul 13, 2005 6:44 am
Posts: 1
Hi,
I'm using hibernate-2.1
and my relational DB is Microsoft SQL Server 2000 - 8.00.760.
When i used sql server specific functions like datepart and cast in the select clause of my hql, hibernate was throwing undefined alias error. To solve that, i extended the sqlserverdialect class and registered these functions as StandardSQLFunction.
Now these functions are working fine in my hql. But if i nest my functions, hibernate is not able to recognize it. Given below is the hql that i tried from console.

Hql is
select tbl0.pbxId,
cast(datepart(mm,tbl0.callEndTs) as varchar)
from com.sti.billing.CallDetail tbl0
where tbl0.callDetailRowId = 3953


and the error i'm getting is
1 errors occurred while listing (and calling getPathNames).
net.sf.hibernate.exception.SQLGrammarException: Could not execute query
java.sql.SQLException: Line 1: Incorrect syntax near 'asvarchar'.


Even though there is a space between 'as' and 'varchar' in my hql, when it is translated to sql, the space is getting removed.
I'm not facing this problem if i don't nest these functions. Also if i have these nested functions in my where clause, it is not creating any problem.
The problem occurs only in the select clause.

I have to get this working urgently.
Any help on this would be really appreciated.

Regards,
Kartikeya


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

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.