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

Gus Heck (JIRA) noreply at atlassian.com
Fri Jul 24 12:46:12 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2140?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33667#action_33667 ] 

Gus Heck commented on HHH-2140:
-------------------------------

Ah... interestingly enough I had inadvertently made the collection with a many-to-many rather than one-to-many element... When I switched it to one-to-many, this error went away...

HTH...

> 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: Hibernate Core
>          Issue Type: Bug
>          Components: query-sql
>    Affects Versions: 3.1.3
>            Reporter: Artur Jonak
>         Attachments: hibernate-testcase.zip
>
>
> 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