[ 
https://issues.apache.org/jira/browse/METAMODEL-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15142665#comment-15142665
 ] 

Kasper Sørensen commented on METAMODEL-233:
-------------------------------------------

I looked into the stack and it seems that this is happening when MM is making a 
clone of the original Query, to be used for the String-representation of the 
compiled query.

Can you share the query that you're compiling? Or at least it's structure with 
anonymized table/column names if you prefer.

> Compile query creation gives IndexOutOfBoundsException with v4.5.0
> ------------------------------------------------------------------
>
>                 Key: METAMODEL-233
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-233
>             Project: Apache MetaModel
>          Issue Type: Bug
>    Affects Versions: 4.5.0
>            Reporter: Ankit Kumar
>
> With the upgrade to Metamodel 4.5.0 we notice existing Junits fail in compile 
> query creation with IndexOutOfBoundsException during query rewriting. 
> NOTE: The dao's and the Junits work with Metamodel v4.4.1.
> Stacktrace : - 
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.479 sec <<< 
> FAILURE! - in com.hi.cdi.test.DbTestUtilsTest
> com.hi.cdi.test.DbTestUtilsTest  Time elapsed: 0.479 sec  <<< ERROR!
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'RawSourceDataDao': Injection of autowired dependencies failed; 
> nested exception is org.springframework.beans.factory.BeanCreationException: 
> Could not autowire field: private com.hi.cdi.datastore.SourceDataDao 
> com.hi.cdi.rawdatastore.RawSourceDataDao.sourceDataDao; nested exception is 
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'SourceDataDao': Invocation of init method failed; nested exception 
> is java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
>       at java.util.ArrayList.rangeCheck(ArrayList.java:653)
>       at java.util.ArrayList.get(ArrayList.java:429)
>       at 
> org.apache.metamodel.query.AbstractQueryClause.getItem(AbstractQueryClause.java:111)
>       at org.apache.metamodel.query.SelectItem.clone(SelectItem.java:602)
>       at org.apache.metamodel.query.Query.clone(Query.java:606)
>       at 
> org.apache.metamodel.jdbc.dialects.DefaultQueryRewriter.beforeRewrite(DefaultQueryRewriter.java:62)
>       at 
> org.apache.metamodel.jdbc.dialects.AbstractQueryRewriter.rewriteQuery(AbstractQueryRewriter.java:74)
>       at 
> org.apache.metamodel.jdbc.dialects.LimitOffsetQueryRewriter.rewriteQuery(LimitOffsetQueryRewriter.java:52)
>       at 
> org.apache.metamodel.jdbc.JdbcCompiledQuery.<init>(JdbcCompiledQuery.java:51)
>       at 
> org.apache.metamodel.jdbc.JdbcDataContext.compileQuery(JdbcDataContext.java:306)
>       at 
> com.hi.cdi.datastore.SourceDataDao.getCompiledQueryToGetDistinctRecordTypesFromSourceData(SourceDataDao.java:1298)
>       at 
> com.hi.cdi.datastore.SourceDataDao.initSchemaObjects(SourceDataDao.java:131)
>       at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:497)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to