Cannot use { in string literal of native SQL query

Description

a JPA Native query will throw an exception if a { is within a string literal.

Rejected Hibernate Defect: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2744

Exception: Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: Unmatched braces for alias path

Query example (taken from HHH-2744)

select count(distinct v.id) from some_table v left join other_table p on v.id = p.foreign_id where upper(v.last_name) like upper('{%');

No where do I find in the JPA specification that SQL queries can be limited; if the SQL is valid, it should be able to be parsed by the JPA Native Query support.

I understand there is a work around, but it should be allowed. The {} balance check shouldn't count {} that are within string literals.

Environment

Hibernate 3.3.2.GA_CP01, Oracle 10g, Windows 32bit, Java 1.6

Assignee

Unassigned

Reporter

Neil Buesing

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Affects versions

Priority

Major
Configure