users@glassfish.java.net

'Invalid column index' error while executing the ejb-ql

From: <glassfish_at_javadesktop.org>
Date: Thu, 14 Aug 2008 10:16:11 PDT

Hi,

I've the following ejbql:

                        <query>
                                <description>Find all siblings for given CategoryId</description>
                                <query-method>
                                        <method-name>findByCategoryIdAllSiblings</method-name>
                                        <method-params>
                                                <method-param>int</method-param>
                                                <method-param>int</method-param>
                                        </method-params>
                                </query-method>
                                <ejb-ql>SELECT OBJECT(o) FROM Category o ,Category category
                                                WHERE category.categoryId = ?1 AND
                                                o.parentCategoryId = category.parentCategoryId
                                                AND o.categoryRootId = ?2
                                                ORDER BY o.displayOrder
                                </ejb-ql>
                        </query>

When calling the finder method, glassfish throws the following error:

[#|2008-08-14T11:18:52.473-0500|WARNING|sun-appserver9.1|javax.enterprise.system.container.ejb.entity.finder|_ThreadID=18;_ThreadName=httpSSLWorkerThread-7001-1;_RequestID=d2c76291-f135-41dc-8fbd-809f4f743125;|JDO74009: Bean 'Category' method ejbFindByCategoryIdAllSiblings: problems running JDOQL query with params [279, 89]
com.sun.jdo.api.persistence.support.JDODataStoreException: JDO76400: Got a JDBC SQLException while executing the SQL statement:
SQL statement<select t0."CATEGORY_ID", t0."CATEGORY_NAME", t0."PARENT_CATEGORY_ID", t0."DISPLAY_ORDER", t0."VERSION" from "AAHM_CATEGORY" t0, "AAHM_CATEGORY" t1 order by t0."DISPLAY_ORDER"> with input values:java.lang.Integer:279, java.lang.Integer:89.
Please examine the SQLException for more information.
NestedException: java.sql.SQLException: Invalid column index
        at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.throwJDOSqlException(SQLStoreManager.java:645)
        at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.executeQuery(SQLStoreManager.java:479)
        at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.retrieve(SQLStoreManager.java:376)
        at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.retrieve(PersistenceManagerImpl.java:1118)
        at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.doExecute(QueryImpl.java:689)
        at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.executeWithArray(QueryImpl.java:607)
        at com.biperf.services.awardslinqservices.ejb.entity.category.CategoryEJB_132568754_ConcreteImpl.ejbFindByCategoryIdAllSiblings(CategoryEJB_132568754_ConcreteImpl.java:760)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
        at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
        at com.sun.ejb.containers.EJBLocalHomeInvocationHandler.invoke(EJBLocalHomeInvocationHandler.java:237)
        at $Proxy132.findByCategoryIdAllSiblings(Unknown Source)
        at com.biperf.services.awardslinqservices.ejb.session.catalog.command.CategoryHierarchyGetter.getCategoryList(CategoryHierarchyGetter.java:150)
        at com.biperf.services.awardslinqservices.ejb.session.catalog.command.CategoryHierarchyGetter.moveCategory(CategoryHierarchyGetter.java:113)
        at com.biperf.services.awardslinqservices.ejb.session.catalog.CatalogFacadeBean.moveCategory(CatalogFacadeBean.java:312)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

Please let me know what I am doing wrong.

Thanks
Suneel
[Message sent by forum member 'suneelgv' (suneelgv)]

http://forums.java.net/jive/thread.jspa?messageID=293374