-->
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.  [ 3 posts ] 
Author Message
 Post subject: Query substitution syntax
PostPosted: Thu Jan 20, 2005 5:17 am 
Newbie

Joined: Fri Aug 20, 2004 8:37 am
Posts: 2
Hibernate version:
2.1.6

Mapping documents:
hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N', EMPTY_STRING=' '

Debug level Hibernate log excerpt:
Setting log4j.logger.net.sf.hibernate.cfg.SettingsFactory=debug gives the following log:
09:53:23,062 INFO SettingsFactory:118 - Query language substitutions: {EMPTY_STRING=', no='N', true=1, yes='Y', '=, false=0}

There is not much documentation about the way Hibernate handles query substitutions. Up to now, I wasn't able to find an accurate description of the expected syntax.

For instance, if I use the following substitution EMPTY_STRING ' ', Hibernate just interprets it as:
-EMPTY_STRING should be replaced with '
-' should be replace with nothing

This is due to the fact Hibernate analyzes the hibernate.query.substitutions property with a StringTokenizer using " ,=;:\n\t\r\f" as delimiters. So it takes no account whether empty spaces occur between a keyword and its substitution or inside the subsitution itself.

More generally any character used as a delimiter can't be a part of the substitution.

So could anyone please tell me if this is an expected behaviour?
If not, I suggest using regular expressions to analyze query substitutions in a more efficient way. For instance, this could allow to prevent characters inside a quoted string from being considered as delimiters.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 20, 2005 6:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Patches are always welcome :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 20, 2005 8:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
but not contributions that depends on jdk 1.4+ only features.

_________________
Max
Don't forget to rate


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