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.
|