[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2140) SQLQueryParser throws ArrayIndexOutOfBoundsException: -1 for SQL query with join mapped as set of string elements

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Wed Oct 11 05:08:25 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2140?page=comments#action_24766 ] 

Max Rydahl Andersen commented on HHH-2140:
------------------------------------------

could you make a testcase ? I can't make it fail with the above.

> SQLQueryParser throws ArrayIndexOutOfBoundsException: -1 for SQL query with join mapped as set of string elements
> -----------------------------------------------------------------------------------------------------------------
>
>          Key: HHH-2140
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2140
>      Project: Hibernate3
>         Type: Bug

>   Components: query-sql
>     Versions: 3.1.3
>     Reporter: Artur Jonak

>
>
> I have the following mapping:
> <class name="GCPSimpleDocumentImpl" table="GCP_Node" mutable="false">
>   <id name="DocumentId" />
>   ...
>   <set name="ApplicationAreas" table="GCP_ApplicationArea" cascade="none" order-by="Name" sort="natural" mutable="false">
>     <key column="DocumentId"/>
>     <element type="string" column="Name"/>
>   </set>
> </class>
> and I try to run an SQL query:
> List result = session.createSQLQuery(
> 	"select distinct {node.*}, {areas.*} from GCP_Node node join GCP_ApplicationArea areas on node.DocumentId=areas.DocumentId " +
> 	"where areas.Name like 'BS - CF%'")
> .addEntity("node", GCPSimpleDocumentImpl.class)
> .addJoin("areas", "node.ApplicationAreas")
> .list();
> Unfortunately I get the following exception:
> java.lang.ArrayIndexOutOfBoundsException: -1
> 	at org.hibernate.loader.custom.SQLQueryParser.substituteBrackets(SQLQueryParser.java:133)
> 	at org.hibernate.loader.custom.SQLQueryParser.process(SQLQueryParser.java:85)
> 	at org.hibernate.loader.custom.SQLCustomQuery.<init>(SQLCustomQuery.java:157)
> 	at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:20)
> 	at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:113)
> 	at org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:137)
> 	at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
> 	at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
> ...

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