-->
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.  [ 7 posts ] 
Author Message
 Post subject: Values beginning with colon treated as named parameters?
PostPosted: Tue Jun 22, 2004 7:50 pm 
Newbie

Joined: Tue Jun 22, 2004 7:42 pm
Posts: 1
Quote:
select x from fmc_web.pool.Pool x left join x.containers c0 where (upper(x.name) = upper(':') and c0.id = 1)

The HQL above fails with the error "Not all named parameters have been set".

This is because the ':' is interpreted as the start of a named parameter. There seems to be no way to 'escape' the colon to make Hibernate treat it like a regular character.

Is this a bug in Hibernate, or are we just not good enough at reading the documentation?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 9:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I'd call that a bug ;)

Please submit it to JIRA. Thanks.


Top
 Profile  
 
 Post subject: Has this been fixed in 3.0?
PostPosted: Tue Jul 05, 2005 1:53 pm 
Newbie

Joined: Tue May 10, 2005 2:22 pm
Posts: 10
I'm using 3.0 and I need to be able to escape the leading colon in the where clause of an HQL statement. I've tried \: and :: but those don't work although the following post seems to indicate those escape sequences should work:

http://opensource.atlassian.com/project ... se/HB-1042


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 05, 2005 2:24 pm 
Newbie

Joined: Tue May 10, 2005 2:22 pm
Posts: 10
Before someone replies that I can "simply" use named parameters, I will add that that solution is non-trivial in my situation. I'm dynamically building a query that involves multiple optional sub-queries and it would mean major changes to the code. It would be so much simpler in my case if I could just escape the colon. My WHERE clause with the colon is similar to:

WHERE upper(last_name) like ':%'


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 16, 2006 6:38 pm 
Newbie

Joined: Wed Jul 26, 2006 9:53 pm
Posts: 16
I am facing a similar problem, I cannot use named parameters as the query string is dynamically generated.
Even thougha lot places I read that this has been fixed for HB3 but I am using 3.0.5 and it doesnt seems to be working.
has this been resolved in 3.2???


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 3:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why don't you just try ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 1:10 pm 
Newbie

Joined: Tue Oct 31, 2006 12:32 pm
Posts: 1
Escaping colons seems to be possible, in at least version 3.0.5, by using a double colon ("::"). Using a regular escape character for the colon does not seem to work. So,
Code:
FROM User u WHERE lower(u.name) LIKE '%!:%' ESCAPE '!'
does not seem to do the trick.


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