This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I am developing my CMP EJB's using EJB 2.0 Specification. In my one of CMP EJB there is a ejb-finder method with EJB QL as following:- ============================================================ "SELECT Object(b) FROM PartsMaster as b where b.partno like ?1 or b.description like ?2 ORDER BY ?3" ============================================================= But when I am deploying my Bean to my application server (I am using JBOSS4.0), I am getting Error as follows:- ======================================================= 18:33:30,359 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=ejb/PartsDetail,service=EJB org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT Object(b) FROM PartsMaster as b where b.partno like ?1 or b.description like ?2 ORDER BY ?3'; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "3" at line 1, column 97. Was expecting one of: <NUMERIC_VALUED_PATH> ... <STRING_VALUED_PATH> ... <DATETIME_VALUED_PATH> ... ) at org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.<init>(JDBCEJBQLQuery.java:52) at org.jboss.ejb.plugins.cmp.jdbc.JDBCCommandFactory.createEJBQLQuery(JDBCCommandFactory.java:60) at org.jboss.ejb.plugins.cmp.jdbc.JDBCQueryManager.start(JDBCQueryManager.java:272) =======================================================
However above EJB Query is working fine without "ORDER BY" Clause into it. Later I came to know that EJB 2.0 not supports "ORDER BY" clause in EJB QL, So I modified my ejb-jar.xml's DTD as follows so that it would be compatible with EJB2.1:- ================ <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" version="2.1"> ================
But again I am getting same error as above when I am deploying my bean. Can anybody tell me how to solve this problem using EJB QL only? I don't want to use JBOSS QL here. Please help me. Thanx in advance. Pras
Hi, My "b.partno" is string and I don't have any problem regarding it in my above EJBQL Query. Only I have problem with "ORDER BY" Clause, as i am not able to include it in my EJBQL. as far as i know "ORDER BY" clause in EJBQL is supported in EJB 2.1 Spec. onwards. But here I am not able to include "ORDER BY" in my EJBQL though currently my EJB spec is 2.1, Can anybody tell me why it is happening? Also If I want to use it through JBOSSQL how should I write it? Thanx. Pras