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.  [ 5 posts ] 
Author Message
 Post subject: how to use SQL SERVER 2000 "CONVERT" FUNCTION IN
PostPosted: Wed Nov 02, 2005 5:20 am 
Newbie

Joined: Thu Sep 29, 2005 9:54 pm
Posts: 17
i have a hql query

in the query i want to use the sql query special word is "CONVERT"

such as:


select convert(varchar(10),loginTime,20)

from admin group by convert(varchar(10,loginTime,20)

but when i ren the query use hibernate occure a error is

the "convert alias error"


how can i do

or the hibernate does not support "CONVERT"

or how to convert the sql query to hql


who can help me thanks everybody


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 6:21 am 
Newbie

Joined: Fri Oct 14, 2005 1:27 am
Posts: 14
Location: Bangalore
You may also express queries in the native SQL dialect of your database.

Native SQLs are your queries that you write in your database.

Native SQL queries may be defined in the mapping document and called in exactly the same way as a named HQL query.

example:

<sql-query name="mySqlQuery">
<return alias="person" class="eg.Person"/>
SELECT person.NAME AS {person.name},
person.AGE AS {person.age},
person.SEX AS {person.sex}
FROM PERSON person WHERE person.NAME LIKE 'Hiber%'
</sql-query>

List people = sess.getNamedQuery("mySqlQuery")
.setMaxResults(50)
.list();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 6:31 am 
Newbie

Joined: Thu Sep 29, 2005 9:54 pm
Posts: 17
Abhilash wrote:
You may also express queries in the native SQL dialect of your database.

Native SQLs are your queries that you write in your database.

Native SQL queries may be defined in the mapping document and called in exactly the same way as a named HQL query.

example:

<sql-query name="mySqlQuery">
<return alias="person" class="eg.Person"/>
SELECT person.NAME AS {person.name},
person.AGE AS {person.age},
person.SEX AS {person.sex}
FROM PERSON person WHERE person.NAME LIKE 'Hiber%'
</sql-query>

List people = sess.getNamedQuery("mySqlQuery")
.setMaxResults(50)
.list();


ok,i see you method but how can i use the method instance my

sql query ????can you tell me and thank you


Top
 Profile  
 
 Post subject: and my query is dynamic
PostPosted: Wed Nov 02, 2005 6:46 am 
Newbie

Joined: Thu Sep 29, 2005 9:54 pm
Posts: 17
my query is dynamic

so i haven't a good idea come true "convert" function from sql server


but hibernate can support "count" funciont

why not support "convert" or i am not know what the method

who can tell me????


Top
 Profile  
 
 Post subject: why not reply
PostPosted: Thu Nov 03, 2005 1:11 am 
Newbie

Joined: Thu Sep 29, 2005 9:54 pm
Posts: 17
hello Everybody

why not a person reply my question?????????????//



who can give me reply???555


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.