For me I think that there should be an option to enable/disable global quoting of the alias generated name. This is a belt-and-braces fix that might get users our of trouble so regardless of how ugly quoting is it can be used to get out of a stick situation.
By default hibernate should just workout the box, so possible solutions:
- Ensure to quote the alias if the column it is based on is also quoted (automatic quoting of aliases)
- Understand when the resulting alias needs to be quoted, and quote is when necessary.
- Ensure to omit any non-ASCII characters in resulting alias, simply skip that character from being used.
- Use a completely random alias name that confirms to cross-database accepted identifier tokens.
Possible useful reference to the problem:
This blog entry also indicates the fix might be as simple as toLowerCase(Locale.ENGLISH) to force use of ASCII ? Then if this works consider auditing the entire codebase for other toLowerCase usage
This problem has not hit me directly but I have been looking at quoting support with HBM and PostgreSQL. This database converts all unquoted identifiers to lowercase, so anything with an uppercase character needs to be quoted to preserve the case.