[jboss-jira] [JBoss JIRA] (WFLY-5572) JPQL to SQL expands Strings with entity names

Steve Fisher (JIRA) issues at jboss.org
Fri Oct 23 10:47:00 EDT 2015


Steve Fisher created WFLY-5572:
----------------------------------

             Summary: JPQL to SQL expands Strings with entity names
                 Key: WFLY-5572
                 URL: https://issues.jboss.org/browse/WFLY-5572
             Project: WildFly
          Issue Type: Bug
          Components: JPA / Hibernate
    Affects Versions: 10.0.0.CR2
            Reporter: Steve Fisher
            Assignee: Scott Marlow


I have some JPQL fragments stored as the "what" field in the "Rule" object. The JPQL query: 

SELECT DISTINCT $0$ FROM Rule $0$ JOIN $0$.grouping $1$ WHERE  ( $0$.what = 'SELECT x FROM Investigation x' AND $0$.crudFlags = 'CRUD' ) AND ( $1$.name = 'notroot' )

is translated to the SQL:

select distinct rule0_.id as id1_30_, rule0_.CREATE_ID as CREATE_I2_30_, rule0_.CREATE_TIME as CREATE_T3_30_, rule0_.MOD_ID as MOD_ID4_30_, rule0_.MOD_TIME as MOD_TIME5_30_, rule0_.bean as bean6_30_, rule0_.c as c7_30_, rule0_.crudFlags as crudFlag8_30_, rule0_.crudJPQL as crudJPQL9_30_, rule0_.d as d10_30_, rule0_.fromJPQL as fromJPQ11_30_, rule0_.grouping_id as groupin19_30_, rule0_.includeJPQL as include12_30_, rule0_.r as r13_30_, rule0_.restricted as restric14_30_, rule0_.u as u15_30_, rule0_.varCount as varCoun16_30_, rule0_.what as what17_30_, rule0_.whereJPQL as whereJP18_30_ from RULE_ rule0_ inner join Grouping grouping1_ on rule0_.grouping_id=grouping1_.id where rule0_.what='SELECT x FROM org.icatproject.core.entity.Investigation x' and rule0_.crudFlags='CRUD' and grouping1_.NAME='notroot'

Note that the original value of "what" which was 'SELECT x FROM Investigation x' has been expanded into 'SELECT x FROM org.icatproject.core.entity.Investigation x' which is clearly incorrect



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list