EJBQL IN or not IN?

I'm trying to develop an EJBQL query, and I can't seem to express what I want - there may be a way, please let me know what you think.
The schema: I have a table called 'Vouchers', and a table called 'Courses'. There is a many-to-many relationship between the two, represented by a join table - 'VouchersCourses'. But some vouchers always relate to all courses; these vouchers have field 'courseCoverage' set to 3, and are not represented in the join table.
The finder: I want to find all the vouchers for a given courseID. The result should include all the vouchers that specifically reference the course, plus all the vouchers that are valid for all courses.
I tried the following:
* @ejb.finder
*           view-type = "local"
*           signature="Collection findByCourse(java.lang.String crsId)"
*      query="SELECT DISTINCT OBJECT(v) FROM VoucherSchema v, IN (v.courses) AS c WHERE v.courseCoverage = 3 OR c.id = ?2"But the resulting Collection ignores all those with courseCoverage = 3. I guess this is because these vouchers are not IN v.courses!
How do I retrieve all the relevant vouchers in v.courses, PLUS all those that are not in v.courses, but have courseCoverage = 3?
Thank you for your help.
Bruno.

Correction - the query should read:
*      query="SELECT DISTINCT OBJECT(v) FROM VoucherSchema v, IN (v.courses) AS c WHERE v.courseCoverage = 3 OR c.id = ?1"But the problem remains.
Hope someone can suggest a solution.
Bruno.

Similar Messages

  • EJB 3.0: EJBQL aggregate functions not working properly

    Hi!
    We are experiencing problems when using aggregate functions within EJBQL queries. In my case, we have to use max() function to retrieve the max start_date from a specific table. In order to do this, we wrote the following code:
    String strQuery = "select max(o.dt_fim) from Questionario o";
    Query queryTeste = em.createQuery(strQuery);
    List x = queryTeste.getResultList();
    OBS: dt_fim is an Oracle 10g datetime column, with its corresponding entity attribute in Questionario entity class.
    AFAIK, the query above should return only one record (object instance) containing the date value, right? However, it brougth a list of the entity objects, corresponding to all records in the table, as we had just run "select o from Questionario o".
    Examining the server log we can see this behavior:
    [TopLink Fine]:2006.09.12 01:47:55.526--
    ServerSession(7119662)--Connection(7048401)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])
    --SELECT ID_QUEST, DT_INICIO, DT_FIM, DS_QUEST, DT_CRIACAO, TP_QUEST, NM_QUEST, COD_SEGMENTO, ID_GRUPO FROM TBBOP_QUEST
    Are anyone experiencing this issue?
    Is there any workaround?
    Any help would be much appreciated, since we need to deploy the application for user testing asap.
    Thanks in advance.
    Best regards,
    Gustavo
    PS: We are using JDeveloper 10.1.3.0.4(SU4)
    Message was edited by:
    Gustavo Lopes Sobral

    The 10.1.3.0 versions of JDeveloper contain our early preview of EJB 3.0 JPA functionality. One limitation is that the query language is not complete (released before the spec was finalized).
    You can use TopLink Essentials (JPA Reference implementation) whihc contains a complete compliant implementation of the final specification.
    http://otn.oracle.com/jpa
    The 10.1.3.1 JDeveloper preview ships with TopLink Essentials.
    Doug

  • EJBQL syntax in OC4J

    Hi,
    I am migrating an application from Weblogic to OC4J. I'm getting an error while using a SQL statement for EJB-QL in Oc4J. It works fine from Weblogic app server. The EJB-QL SQL used in ejb-jar.xml is something like the following:
    <ejb-ql>SELECT      OBJECT(o) FROM tableA AS o WHERE (o.column1 = ?1 OR (?1 IS NULL AND o.column1 IS NULL)) AND     (o.column2 = ?2 OR ( ?2 IS NULL AND o.column2 IS NULL)) AND (o.column3 = ?3 OR ( ?3 IS NULL AND o.colum3 IS NULL)) AND (o.column4 = ?4 OR ( ?4 IS NULL AND o.column4 IS NULL)) AND     (o.column5 = ?5 OR ( ?5 IS NULL AND o.column5 IS NULL))</ejb-ql>
    Can somebody point out what could be wrong in the SQL? The same EJB-QL SQL executes properly from the SQL*Plus command. Is there a syntax error in the statement?
    How can I modify this so that it does not affect the result of the SQL? There is some problem with the use of brackets. I tried some combinations but no luck.
    When deploying the EJB to OC4J with the above SQL as EJB QL SQL, I got the following error:
    com.evermind.client.orion.AdminCommandException: Deploy error: deploy failed!: ; nested exception is:
         oracle.oc4j.admin.internal.DeployerException: Error initializing ejb-module; Exception Error translating EJBQL: Encountered "?1 IS" at line 1, column 31.
    Was expecting one of:
    "NOT" ...
    "+" ...
    "IdentificationVar" ...
    <CHAR_LITERAL> ...
    <STRING_LITERAL> ...
    <INPUT_PARAM> "*" ...
    <INPUT_PARAM> "/" ...
    <INPUT_PARAM> "+" ...
    <INPUT_PARAM> "-" ...
    <INPUT_PARAM> ")" ...
    <INPUT_PARAM> "NOT" ...
    <INPUT_PARAM> "BETWEEN" ...
    <INPUT_PARAM> "MEMBER" ...
    "CONCAT" ...
    "SUBSTRING" ...
    "LOCATE" ...
    "LENGTH" ...
    "ABS" ...
    "SQRT" ...
    EJB QL statement : 'SELECT      OBJECT(o) FROM tableA AS o WHERE (o.column1 = ?1 OR (?1 IS NULL AND o.column1 IS NULL)) AND     (o.column2 = ?2 OR ( ?2 IS NULL AND o.column2 IS NULL)) AND (o.column3 = ?3 OR ( ?3 IS NULL AND o.colum3 IS NULL)) AND (o.column4 = ?4 OR ( ?4 IS NULL AND o.column4 IS NULL)) AND     (o.column5 = ?5 OR ( ?5 IS NULL AND o.column5 IS NULL))
    Thanks for your help.
    vadi.

    Hi,
    Can somebody please give me few pointers or clues?
    Thanks,
    Vadi

  • OC4J EJBQL and EJB 2.0 features

    Hello Debu Panda and All
    I've got all howtos and I mangaged to get some parts of OC4J [Oracle9iAS (9.0.3.0.0) Containers for J2EE (build 020323.1689)] working.
    There are still some issues that are stalling our development. Could you please comment on them, maybe providing an estimate of when they will be solved/implemented?
    First of all, a little background. Our application uses many Java Swing application clients that connect to the EAR application in the container.
    The ear application has the following structure:
    All database access (Oracle 8i, located in its own server) is done exclusively by means of CMP entity beans. A entity bean may access other entity beans. There are workflow session beans (stateful and stateless) that access the entity beans. All clients see only the workflow session beans (session beans fagade).
    Our applicatoin is complex, having more than 80 session beans and more than 25 entity beans (not counting entity beans that exist only to represent relationships among entity beans).
    There goes the questions:
    1) It seems that entity beans cannot currently be referenced by remote interfaces. We couldn't deploy our application using it. Since we could use only local interfaces fot entity beans, thats what is been done now.
    2) There is no CMR supported. Is this true?
    3) EJBQL seems to be very limited. In the howto examples there are EJBQL statements that compare two numbers. However, when we tried to use String comparisons, it didn't work. Here is the statement:
    "SELECT DISTINCT OBJECT(p) FROM Person p WHERE p.name = ?1"
    If I compile, package and deploy the ear applicatin with the above EJBQL statement, OC4J generates an exception when executing the finder method. The exception is:
    "java.rmi.NoSuchObjectException: Session has timed out
    at com.evermind.server.ejb.StatefulSessionEJBObject.throwPassivisat
    ception(StatefulSessionEJBObject.java:188)
    at Cad023Remote_StatefulSessionBeanWrapper0.obterPessoasPorParteNom
    023Remote_StatefulSessionBeanWrapper0.java:754)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:8
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)"
    If I remove the where clause, the expection is gone. However, I get all records. ;-)
    4) It seems that all EJBQL clauses must be capitalized. Is this true?
    FINALY)
    Is there a newer OC4J build that could use to get the development going? Do you know where there will be one? Is there any way of contacting the OC4J development team to report bugs?
    If you would like, we could discuss it in private e-mail (please use my private mail [email protected]).
    Thanks for your attention,
    Luis Fernando Soeiro
    Hi !! OC4J 9.0.3 developer's preview has most features of EJB 2.0. We are working on updating on our docs and samples for EJB 2.0
    Please look at the following URL that has some How Tos on EJB 2.0 features such Local Interfacea, EJB QL, etc : http://otn.oracle.com/tech/java/oc4j/htdocs/oc4j-how-to.html#ejb
    regards
    Debu Panda
    Oracle --------------------------
    Luis Soeiro <mailto:[email protected]> <mailto:[email protected]>Type : Question Date : Apr 11, 2002 15:15 PT Hello
    Some colleagues and I are trying to port a large project from JBOSS to OC4J. We used JBOSS 3.0 (beta) in order to evaluate EJB2.0 features and see if we could use it. We already have OC4J in production, but only as a JSP/Servlet container. The next step would be to deploy our EJB application to OC4J.
    We have read the material and it is written that OC4J (developers preview) is EJB 2.0 compliant. However, the specific documentation and the examples don't show how to specify OC4J specifc XML files. We absolutely need CMR and Local Interfaces, because we don't have the time required to downgrade our JBoss EJB2.0 application to the EJB 1.1 specification. We have over 80 Session Beans and over 20 Entity Beans.
    Is there anybody there that can confirm that OC4J developer's preview is really EJB2.0 compliant? If so, could you send me some pointers to information about OC4J container specifc deployment descriptors? The docs listed at the web site don't have EJB2.0 features listed, nor does the Oracle samples.
    Thanks for your attention,
    desperately,
    Luis Fernando Soeiro

    HI,
    I worked out CMR and EJB-QL with single bean.
    Using CMR, it is possible to get one bean reference through other bean, but
    When I tried EJB-QL with bean to bean navigation then I run into problem.

  • Not able to start JAVA Central Instance

    Hello All,
                      After doing JAVA Support Pack through JSPM I am not able to start the JAVA Central Instance of Solman.
    Pasting the disp+work error.
    Tue Nov 10 09:17:54 2009
    J2EE server info
      start = TRUE
      state = STARTED
      pid = 6020
      argv[0] = G:\usr\sap\DSM\DVEBMGS01\exe\jcontrol.EXE
      argv[1] = G:\usr\sap\DSM\DVEBMGS01\exe\jcontrol.EXE
      argv[2] = pf=G:\usr\sap\DSM\SYS\profile\DSM_DVEBMGS01_GOLITSAPD36
      argv[3] = -DSAPSTART=1
      argv[4] = -DCONNECT_PORT=64990
      argv[5] = -DSAPSYSTEM=01
      argv[6] = -DSAPSYSTEMNAME=DSM
      argv[7] = -DSAPMYNAME=GOLITSAPD36_DSM_01
      argv[8] = -DSAPPROFILE=G:\usr\sap\DSM\SYS\profile\DSM_DVEBMGS01_GOLITSAPD36
      argv[9] = -DFRFC_FALLBACK=ON
      argv[10] = -DFRFC_FALLBACK_HOST=localhost
      start_lazy = 0
      start_control = SAP J2EE startup framework
    DpJ2eeStart: j2ee state = STARTED
    DpJ2eeLogin: j2ee state = CONNECTED
    Tue Nov 10 09:18:03 2009
    ***LOG Q0I=> NiIRead: recv (10054: WSAECONNRESET: Connection reset by peer) [nixxi.cpp 4424]
    ERROR => NiIRead: SiRecv failed for hdl 6 / sock 1320
        (SI_ECONN_BROKEN/10054; I4; ST; 127.0.0.1:1714) [nixxi.cpp    4424]
    DpJ2eeMsgProcess: j2ee state = CONNECTED (NIECONN_BROKEN)
    DpIJ2eeShutdown: send SIGINT to SAP J2EE startup framework (pid=6020)
    ERROR => DpProcKill: kill failed [dpntdisp.c   371]
    DpIJ2eeShutdown: j2ee state = SHUTDOWN
    Tue Nov 10 09:18:14 2009
    DpEnvCheckJ2ee: switch off j2ee start flag.
    Please suggest me.

    Hello Juan,
                        Pasting you the logs:
    dev_w0 :
    Tue Nov 10 20:41:04 2009
    A  GENER starting remote generation: BBP_ALERT_SB_NOTTRANSFERED (requested by W12).
    A  GENER starting remote generation: SAPLSI00 (requested by W12).
    A  GENER starting remote generation: SAPLBBP_PD_SC (requested by W12).

    A Tue Nov 10 20:41:10 2009
    A  GENER starting remote generation: SAPLBBP_PD (requested by W12).

    A Tue Nov 10 20:41:14 2009
    A  GENER starting remote generation: SAPLBBP_MS_C (requested by W12).
    A  GENER starting remote generation: SAPLBBP_PDH (requested by W12).

    A Tue Nov 10 20:41:17 2009
    A  GENER starting remote generation: SAPLCRM_ORDER_CB (requested by W12).

    M Tue Nov 10 21:16:04 2009
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]

    M Tue Nov 10 21:16:05 2009
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]

    M Tue Nov 10 21:41:09 2009
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]

    M Tue Nov 10 22:41:10 2009
    M  *** ERROR => SosIAnchorArrayCreatable: T17/M0 in state cancel [thxxtool2.c  947]
    std_server0.out :
    Nov 10, 2009 6:49:36 AM                            /System/Server [SAPEngine_Application_Thread[impl:3]_32] Group: EJBQL-SQL-Mapper: com.sap.sql.ejb.SQLMapper = com.sap.sql.ejb.common.CommonSQLMapper
    Nov 10, 2009 6:49:36 AM                            /System/Server [SAPEngine_Application_Thread[impl:3]_32] Group: EJBQL-SQL-Mapper: com.sap.sql.ejb.OpenSQLVerification = semantics
    Nov 10, 2009 6:49:36 AM                            /System/Server [SAPEngine_Application_Thread[impl:3]_32] Group: EJBQL-SQL-Mapper: com.sap.sql.ejb.SQLChecker = com.sap.sql.ejb.debug.OpenSQLChecker
    Nov 10, 2009 6:49:36 AM                            /System/Server [SAPEngine_Application_Thread[impl:3]_32] Group: List of currently effective properties ended.
    Nov 10, 2009 6:49:36 AM                            /System/Server [SAPEngine_Application_Thread[impl:3]_32] Group: Closing group
    SAP J2EE Engine Version 7.00   PatchLevel 51441.450 is shutting down!  PatchLevel 51441.450 November 22, 2008 15:34 GMT
    Stopping services.
      Service com.adobe~TrustManagerService stopped. (16 ms)
      Service tcdisdic~srv stopped. (0 ms)
      Service com.adobe~DocumentServicesConfiguration stopped. (0 ms)
      Service rfcengine stopped. (0 ms)
      Service webdynpro stopped. (0 ms)
      Service com.adobe~DocumentServicesDestProtoService stopped. (16 ms)
      Service pmi stopped. (31 ms)
      Service tcsecvsi~service stopped. (0 ms)
      Service tcsecdestinations~service stopped. (0 ms)
      Service tcsecwssec~service stopped. (0 ms)
      Service sld stopped. (0 ms)
      Service tcsecsecurestorage~service stopped. (0 ms)
      Service monitor stopped. (62 ms)
      Service adminadapter stopped. (0 ms)
      Service com.adobe~LicenseService stopped. (0 ms)
      Service basicadmin stopped. (15 ms)
      Service tcsmdserver~service stopped. (16 ms)
      Service configuration stopped. (0 ms)
      Service UT stopped. (0 ms)
      Service ejb stopped. (0 ms)
      Service servlet_jsp stopped. (62 ms)
      Service com.adobe~DocumentServicesLicenseSupportService stopped. (0 ms)
      Service ssl stopped. (0 ms)
      Service com.adobe~XMLFormService stopped. (16 ms)
      Service tcseccertrevoc~service stopped. (0 ms)
      Service com.adobe~DocumentServicesBinaries2 stopped. (0 ms)
      Service com.adobe~PDFManipulation stopped. (0 ms)
      Service com.adobe~DataManagerService stopped. (0 ms)
      Service keystore stopped. (0 ms)
      Service jms_provider stopped. (16 ms)
    std_dispatcher.out :
    Loading services.:
      Service keystore started. (16 ms).
      Service iiop started. (78 ms).
      Service httptunneling started. (0 ms).
      Service memory started. (15 ms).
      Service webservices started. (31 ms).
      Service security started. (0 ms).
      Service sld started. (46 ms).
      Service timeout started. (62 ms).
      Service licensing started. (16 ms).
      Service r3startup started. (125 ms).
      Service ssl started. (78 ms).
      Service jmx_notification started. (141 ms).
      Service shell started. (219 ms).
      Service telnet started. (297 ms).
      Service jmx started. (359 ms).
      Service p4 started. (985 ms).
      Service classload started. (16 ms).
      Service log_configurator started. (2968 ms).
      Service configuration started. (16 ms).
      Service jms_provider started. (1187 ms).
      Service tc.monitoring.logviewer started. (1375 ms).
      Service basicadmin started. (1328 ms).
      Service adminadapter started. (0 ms).
      Service http started. (1844 ms).
      Service monitor started. (766 ms).
    ServiceManager started for 6453 ms.
    Framework started for 10766 ms.
    SAP J2EE Engine Version 7.00   PatchLevel 51441.450 is running!
    PatchLevel 51441.450 November 22, 2008 15:34 GMT
    >
    Login :
    SAP J2EE Engine Version 7.00   PatchLevel 51441.450 is shutting down!  PatchLevel 51441.450 November 22, 2008 15:34 GMT
    Stopping services.
      Service classload stopped. (0 ms)
      Service tc.monitoring.logviewer stopped. (0 ms)
      Service p4 stopped. (16 ms)
      Service ssl stopped. (0 ms)
      Service keystore stopped. (0 ms)
      Service iiop stopped. (3000 ms)
      Service adminadapter stopped. (0 ms)
      Service monitor stopped. (15 ms)
      Service security stopped. (0 ms)
      Service jms_provider stopped. (1000 ms)
      Service basicadmin stopped. (0 ms)
      Service jmx stopped. (0 ms)
      Service webservices stopped. (0 ms)
      Service sld stopped. (0 ms)
      Service telnet stopped. (1000 ms)
      Service http stopped. (1000 ms)
      Service timeout stopped. (0 ms)
      Service configuration stopped. (0 ms)
      Service log_configurator stopped. (0 ms)
      Service memory stopped. (0 ms)
      Service r3startup stopped. (0 ms)
      Service licensing stopped. (0 ms)
      Service httptunneling stopped. (0 ms)
      Service shell stopped. (0 ms)
      Service jmx_notification stopped. (0 ms)
    Please suggest me Juan..

  • EJBQL, MIN and java.sql.Timestamp

    I am trying to create a new finder method for a cmp bean which returns me the date of the oldest bean available.
    the ejbql query looks like this:
    select MIN (a.receiveDate) from AssetSchema as a
    receiveDate is defined as a java.sql.Timestamp field in the bean. I am getting the following error:
    Bean: Asset
    Method: clover.AssetLocal findOldestDeleted()
    EJBQL: select MIN (a.receiveDate) from AssetSchema as a
    Error: JDO75334: Invalid type 'java.sql.Timestamp' of select clause expression for finder method.
    anything wrong with the query or .....

    Instead of using a finder, use an ejbSelect method. You can then use the aggregate function MIN. Wrap the ejbSelect in a home method.
    In remote Home interface, define home method:
    public java.lang.String selectMinSingle() throws RemoteException;
    define the ejbSelect method in EJB class:
    public abstract java.lang.String ejbSelectMinSingle() throws FinderException;
    The ejbSelect is wrapped in a ejbHome method:
    public java.lang.String ejbHomeSelectMinSingle()
    try {
    String s = ejbSelectMinSingle();
    return s;
    } catch(Exception e) {
    throw new EJBException("ejbHomeSelectMinSingle: " + e);
    Call home method from client:
    String s1 = beanHome.selectMinSingle();
    Not sure if this is what you're looking to do.
    There is also the ORDER BY clause; i.e.,
    <ejb-ql>Select p.quantity from ProductBean p ORDER BY p.quantity</ejb-ql>
    use the ASC or DESC keyword:
    <ejb-ql>Select p.quantity from ProductBean p ORDER BY p.quantity ASC</ejb-ql>
    For finder:
    query>
    <description></description>
    <query-method>
    <method-name>findProductsByHighestQuantity</method-name>
    <method-params />
    </query-method>
    <ejb-ql>Select DISTINCT OBJECT(p) From ProductBean p ORDER BY p.quantity DESC</ejb-ql>

  • Using sub quries in EJBQL

    Hi
    I am using EJBQL to extract the employee records from database with EJB3 using toplink
    query is as follows
    "SELECT e FROM Employee e WHERE e.empId not in (Select a.empId.empId FROM Attendancerecord a WHERE a.date = :date)"
    where each employee has many attendance record and in reverse each attendance record tuple has one employee relation
    what I want to do is to 'select all those employees for which there is no record in Attendance record for specific date '
    when executing the exception caught is that
    java.sql.SQLException: Subquery returns more than 1 row
    e.empId is an integer
    kindly help
    rgards
    Hina

    Think about how the e-mail will look to the person reading it. There will be some links, of course. And how should those links look? They should look like something that somebody could use from anywhere on the Internet. So obviously "C:\data\wombat.gif" isn't going to work. Your best bet is for the link to look something like "http://www.animallovers.org/wombat.gif", and that means you need a web server that can serve out those files.

  • EJBQL join syntax example

    Some sample EJBQL:
    select distinct t1 from Table1 t1 join Table2 t2 where t1.col1 = t2.col2
    Is there any syntactic reason why this should not work? I'm struggling to get a join working and I can't find any good examples of the correct syntax.
    many thanks
    R

    To perform a join, the collection has to exist in the entity? So, a collection of Table2's would need to be in Table1?

  • Ejbql documentation?

    Hi, where can i find documentation describing what parts of ejbql have been implemented in oc4j in jdeveloper 10.1.3?
    Thanks,
    Andrej

    Unfortunately I could not find any references for such documentation. You may want to contact support to see if they have had similar questions.
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • EJBQL problem

    I downloaded the latest OC4J which claims support of EJBQL. But, when I deployed ejb-jar.xml, I always got error message:
    java.lang.RuntimeException: No method found for XML query element: Ambiguous or
    invalid <query-method>
    at com.sun.enterprise.deployment.xml.EjbNode.parseQueries(EjbNode.java:6
    23)
    at com.sun.enterprise.deployment.xml.EjbNode.completeLoadingDescriptor(E
    jbNode.java:596)
    at com.sun.enterprise.deployment.xml.EjbBundleNode.completeLoadingDescri
    ptor(EjbBundleNode.java:469)
    at com.sun.enterprise.deployment.EjbBundleDescriptorFactory.makeEjbBundl
    eDescriptor(EjbBundleDescriptorFactory.java:44)
    at com.evermind.server.ejb.deployment.EJBPackage.init(EJBPackage.java:19
    43)
    at com.evermind.server.ServerComponent.init(ServerComponent.java:224)
    at com.evermind.server.ejb.EJBPackageDeployment.getPackage(EJBPackageDep
    loyment.java:645)
    at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:513)
    at com.evermind.server.Application.postInit(Application.java:429)
    at com.evermind.server.Application.setConfig(Application.java:136)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServe
    r.java:1479)
    at com.evermind.server.ApplicationServer.initializeApplications(Applicat
    ionServer.java:1436)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.jav
    a:1099)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLa
    uncher.java:93)
    at java.lang.Thread.run(Thread.java:484)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:49)
    Error in application sponsoradmin: Error loading package at file:/C:/Oracle/9iAS
    Core/oc4j/j2ee/home/applications/sponsoradmin/ejb/, Failure to initialize EJBQL
    descriptors: java.lang.RuntimeException: No method found for XML query element:
    Ambiguous or invalid <query-method>
    I checked the file few times and could not find any errors. I used the standard QUERY method such as:
         <query>
              <query-method>
                   <method-name>findByOwner</method-name>
                   <method-params><method-param>java.lang.String</method-param></method-params>
              </query-method>
              <ejb-ql>
                   <![CDATA[ SELECT OBJECT(a) FROM contact AS a WHERE owner = ?1 ]]>
              </ejb-ql>
         </query>

    I think EJB-QL is by default disabled in the version available on OTN. If you want to use EJB-QL please start OC4J as follows:
    java -Denable.ejbql=true -jar oc4j.jar
    I tested just now with my sample apps and it works fine.
    regards
    Debu Panda
    Oracle

  • Does EJBQL in JDeveloper support max aggregate function ?

    Does EJBQL in JDeveloper support max aggregate function ?
    I can't get it to work using select max(o.time) from MyObject o; It always returns the MyObject to me.
    Anybody knows how to do this ?
    Thanks.

    No one knows how exactly this works in JDeveloper 11g? As I see it, it's most likely a bug. For one, JDeveloper already supports plenty of databases and enforces some limitations on the useability of these databases where necessary (for instance, JDBC Positioning instead of Oracle's way of binding for the bind variables in a query). However, this enforcement does not happen with the WHERE clause of the view criteria in MySQL when you choose an operator that concatenates strings together in the WHERE clause, such as "contains". You'd expect it's smart enough to use different syntax for concatenating the strings, depending on the database (e.g., CONCAT for MySQL, || for Oracle). Second, lack of this enforcement should not break functionality, and here it does (searching with wildcards in LOV is just not possible declaratively with MySQL), which resembles a bug in the software.
    For now, I've completely rewritten the LOV in Java, so it's not declarative anymore, but programmatic. It works, resembles searching with "contains" and it stays that way, despite of the higher difficulty in maintenance, until this issue can be solved declaratively, by any means: via a patch release or via a workaround. I hope someone can provide me (and quite possibly others facing this issue) with insight upon this.
    Thanks in advance.

  • EJBQL: LIKE

    Hi,
    I just had a look at EJB 2.1 spec, the EJBQL chapter specifically. It is not clear to me whether I can use parameters on the right side of a LIKE, e.g.
    WHERE o.name LIKE ?1
    or even better
    WHERE o.name LIKE '?1%'
    Nowhere in the spec can I find an explanation for 'pattern_value'.
    Does anybody know this?
    Thanx
    Ralf

    Well there's a workaround. you can't create:
    select o from content where o.keywords like %?1%
    But you can do:
    Hi,
    Iam not sure about EJB 2.1 specs. but there is a workaround to achieve the same.
    Have your EJB-QL as:
    select o from object where o.name like ?1
    And pass the %'s into the method.
    So your method call might look like:
    home.findByName("%" + name + "%");
    Cheers

  • EJBQL "myBoolVar = FALSE" compiled as "myBoolVar=0", fails with Postgres

    Hi,
    I have an EJBQL query that contains a test on a boolean variable:
    "select... where myBoolVar=FALSE"
    This query is compiled by Weblogic as :
    "select... where myBoolVar=0"
    which works fine under Oracle and MssqlServer but fails on Postgres (which manages
    a db type "bool").
    I could define this type as int on Postgres side but Postgres doesn't accept a
    resulset.getBoolean() on an int type... Is there a way to specify on Weblogic
    side that a java type should be handled as a specific sql type?
    Thanx for the answer.
    Etienne

    Problem is Fixed !!!
    We were having this problem because IFS installation was not recognising a separate tablespace which we created for IFS, so we started using default USERS tablespace after which the installation was successful.
    Thanks.

  • How-to-ejbql

    Hi! I got an error 'java.sql.SQLException: ORA-01008: not all variables bound' when i run the 'how-to-ejbql' sample code from otn.oracle.com. I checked the generated sql in orion-ejb-jar.xml and they seem to look good. In fact I runned the generated sql in sqlplus and they all worked. Also run the container with -Denable.ejbql=true. Any ideas?
    Thanks
    Win2000
    OC4J1.3 Dev. prev.

    Hi Jeff, here's the portion of the ejb-jar.xml with custom finder..
    <query>
    <description></description>
    <query-method>
    <method-name>findByDeptno</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    </query-method>
    <ejb-ql>select distinct object(e) from Emp e where e.deptno = ?1 </ejb-ql>
    </query>
    and here's the equivalent generated file orion-ejb-jar.xml
    <finder-method query="SELECT DISTINCT OBJECT(e) FROM Emp e WHERE (e.deptno = ? )">
         <!-- Generated SQL: "SELECT DISTINCT e.empno, e.ename, e.job, e.mgr, e.hiredate, e.sal, e.comm, e.deptno FROM Emp e WHERE (e.deptno = ? )" -->
         <method>
         <ejb-name>Emp</ejb-name>
         <method-name>findByDeptno</method-name>
         <method-params>
         <method-param>double</method-param>
         </method-params>
         </method>
    </finder-method>
    As previously written, the custom finder method 'findByDeptNo' will cause an sql exception.
    Thanks.
    Win2000
    Oracle9iAS (9.0.3.0.0)

  • Javax.ejb.EJBException: Method is not a known CMP field accessor...

    Hi !
    I have a little problem. When I deploy my jar file, I have the next message :
    "javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field accessor, or ejbSelect method: methodName=compareTo"
    Is there someone to tell me why ? ^_^
    I didn't put the source code in this topic, not to pollute it, but if you need it, tell me ;)
    Thx for your help.

    Hi Spidey !
    Thx for you help but... Giving my method doesn't require the use of EJBQL, I don't think I have to define it in my deployment descriptor (this is not a query)...
    I give you an idea of my (experimental ^_^) source code :
    public class CountryBean implements EntityBean{
    public int compareTo(Country c){
    SOP("COMPARE TO");
    return 0;
    public class MySession implements SessionBean{
    public int doIt(){
    MyComparator comparator = new MyComparator();
    return comparator.compare(country1, country2);
    public class MyComparator implements Comparator{
    public int compare(Object o1, Object o2){
    return compare((Country)o1, (Country)o2);
    public int compare(Country c1, Country c2){
    SOP("COMPARE");
    return c1.compareTo(c2);
    When I call doIt(), the message "COMPARE" is written and just after, there's this message (the message "COMPARE TO" is never written):
    "11:29:44,204 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
    javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field accessor, or ejbSelect method: methodName=compareTo
    at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:110)
    at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
    at CountryBean$Proxy.compareTo(<generated>)"
    I hope this is clear ^__^
    Thx for helping me ;)

Maybe you are looking for