Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000095 [Resin] minor always 04-12-05 00:00 11-30-05 14:43
Reporter sam View Status public  
Assigned To
Priority urgent Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.0.15 Product Version 3.0.12
  Product Build 3.0.12
Summary 0000095: EJB query with access more than two references deep
Description RSN-86
(rep by A Barton)

We are porting an application from Resin-ee.2.1.x to Resin-pro-3.0.12. We
have discovered a problem in 3.0.12 that had been working fine in 2.1.x. Our
problem seems to be related to the depth of reference in our queries. Our
entity definition includes the following query:

        <query>
            <query-method>
               <method-name>findAll</method-name>
               <method-params>
               </method-params>
            </query-method>
            <ejb-ql><![CDATA[SELECT o FROM Faq o order by
o.faqCategory.categoryName, o.intOrder]]></ejb-ql>
         </query>

We wrote a simple JSP to exercise the problem finder:

<%
    fooblox.faq.FaqHome home =
(fooblox.faq.FaqHome)barblox.commons.ejb.EJBUtils.getLocalHome("FaqBean");
    home.findAll();
%>

Here is the stacktrace:

java.lang.NullPointerException
    at com.caucho.amber.query.ColumnExpr.generateWhere(ColumnExpr.java:124)
    at
com.caucho.amber.query.AbstractAmberExpr.generateSelect(AbstractAmberExpr.ja
va:121)
    at
com.caucho.amber.query.SelectQuery.generateLoadSQL(SelectQuery.java:437)
    at com.caucho.amber.query.SelectQuery.init(SelectQuery.java:291)
    at com.caucho.amber.query.QueryParser.parseSelect(QueryParser.java:399)
    at com.caucho.amber.query.QueryParser.parse(QueryParser.java:238)
    at
com.caucho.amber.connection.AmberConnectionImpl.parseQuery(AmberConnectionIm
pl.java:922)
    at
com.caucho.amber.connection.AmberConnectionImpl.prepareQuery(AmberConnection
Impl.java:894)
    at
com.caucho.amber.connection.AmberConnectionImpl.prepareQuery(AmberConnection
Impl.java:861)
    at _ejb.FaqBean.FaqBean__EJB$LocalHome.findAll(FaqBean__EJB.java:354)


Here is a code snippet from the resin generated source: FaqBean__EJB.java:
...
        query = trans.getAmberConnection().prepareQuery("SELECT o FROM
Faq o ORDER BY o.faqCategory.categoryName, o.intOrder");
        com.caucho.amber.query.ResultSetImpl rs =
(com.caucho.amber.query.ResultSetImpl) query.executeQuery();
        java.util.ArrayList list = new java.util.ArrayList();
        while (rs.next()) {
          com.caucho.ejb.entity.EntityObject item =
(com.caucho.ejb.entity.EntityObject) rs.getObject(1);
          list.add(item);
        }
       rs.close();
...

If we remove the ?o.faqCategory.categoryName? reference from the order by
clause, this finder will return successfully. Our problem seems to be
related to accessing relationships in queries more than two levels deep. We
are experiencing this same problem with ejbSelect methods as well.

Steps To Reproduce
Additional Information Resin-pro 3.0.12
Attached Files

- Relationships

- Notes
(0000099)
ferg
04-12-05 00:00

This does not qualify as a "critical" issue.
 
(0000100)
ferg
04-12-05 00:00

ejb/0t00
 

- Issue History
Date Modified Username Field Change
04-12-05 00:00 sam New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.15
11-30-05 14:43 ferg Status resolved => closed


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
28 unique queries executed.
Powered by Mantis Bugtracker