-->
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: cannont use select distinct(substring(convert))
PostPosted: Wed Jan 02, 2008 10:33 am 
Beginner
Beginner

Joined: Mon Oct 01, 2007 6:23 am
Posts: 20
helloo and happy new year for all!

Im using SQL server database, hiebrnate 3.2

when I send the request below, hibernate truncate a part of sql


Code:
String sql  = "select distinct (substring( (convert(varchar,date,120) ),1,10)) from Table order by date""
List results = getHibernateTemplate().find("sql");


the sql shown by hibernate :
Code:
select
        distinct substring(convert(varchar,
        table0_.Date,
        120)) as col_0_0_
    from
        Table table0_
    order by
        table0_.Date



regards!


Top
 Profile  
 
 Post subject: convert
PostPosted: Thu Jan 03, 2008 4:18 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
Probably Hibernate itself doesn't support the "convert" function, and all those commas inside it are confusing the SQL parser.

_________________
Gonzalo Díaz


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.