[hibernate-issues] [Hibernate-JIRA] Created: (JPA-12) Cannot use { in string literal of native SQL query

Neil Buesing (JIRA) noreply at atlassian.com
Mon Jan 24 09:56:05 EST 2011


Cannot use { in string literal of native SQL query
--------------------------------------------------

                 Key: JPA-12
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-12
             Project: Java Persistence API
          Issue Type: Bug
    Affects Versions: 1.0.0
         Environment: Hibernate 3.3.2.GA_CP01, Oracle 10g, Windows 32bit, Java 1.6

            Reporter: Neil Buesing


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.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list