1 2 Previous Next 22 Replies Latest reply on May 22, 2002 10:31 AM by dsundstrom Go to original post
      • 15. Re: EJB-QL LIKE clause

        addenum : tests realized

        - ejb-jar.xml with ejb-ql without "like" statement / jbosscmp-jdbc.xml with jboss-ql with "like" statement => failed
        - ejb-jar.xml with ejb-ql with "like" statement / jbosscmp-jdbc.xml with jboss-ql with "like" statement => failed
        - ejb-jar.xml with ejb-ql with "like" statement / jbosscmp-jdbc.xml with jboss-ql without "like" statement => failed

        hope this helps

        • 16. Re: EJB-QL LIKE clause
          garyls

          Hi Ionel

          I've just managed to get this working. In the ejb-jar.xml I leave the query value empty, as in query="".
          Remember that the finder MUST exist in both ejb-jar.xml and jbosscmp-jdbc.xml.
          The query statement in the jboss xml file will simply override the one in the ejb-jar.xml

          Another thing, you MUST specify the <result-type-mapping> value in ejb-jar.xml but not the jboss...xml .

          Try it and see if it works
          Cheers
          Gary

          • 17. Re: EJB-QL LIKE clause

            > I've just managed to get this working. In the
            > ejb-jar.xml I leave the query value empty, as in
            > query="".
            According to the ejb-jar_2_0.dtd, the query tag must have at least a query-method tag and an ejb-ql tag.
            Which one needs to be equals to "" ?


            > Remember that the finder MUST exist in both
            > ejb-jar.xml and jbosscmp-jdbc.xml.
            A finder exists because it has been declared in a query tag ?
            So if i've declared a query tag in ejb-jar.xml and jboss...xml, the finder must be declared in both ?


            > The query statement in the jboss xml file will simply
            > override the one in the ejb-jar.xml
            Agree.


            > Another thing, you MUST specify the
            > <result-type-mapping> value in ejb-jar.xml but not
            > the jboss...xml .
            Done. This is local for me


            > Try it and see if it works
            > Cheers
            > Gary
            Thanks but it doesn't work that much.


            The root error message is still the same :

            16:21:08,439 ERROR [XmlFileLoader] XmlFileLoader: File file:/users/vol1/gardais/app-serv/jboss-3.0.0beta/tmp/deploy/92.facade-jms-fakelike.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 85. Error message: Element "query" does not allow "jboss-ql" here.
            16:21:08,443 ERROR [XmlFileLoader] XmlFileLoader: File file:/users/vol1/gardais/app-serv/jboss-3.0.0beta/tmp/deploy/92.facade-jms-fakelike.jar!/META-INF/jbosscmp-jdbc.xml process error. Line: 85. Error message: Element type "jboss-ql" is not declared.


            Here are my ejb-jar.xml and jboss...xml files :

            <snip from ejb-jar.xml>

            select person w/ name starting by ...
            <query-method>
            <method-name>findByNameLike</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <result-type-mapping>Local</result-type-mapping>
            <ejb-ql></ejb-ql>



            <snip from jbosscmp-jdbc.xml>

            select person w/ name starting by ...
            <query-method>
            <method-name>findByNameLike</method-name>
            <method-params>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <jboss-ql>select distinct object(p) from personneBean p where p.nom like ?1</jboss-ql>

            • 18. Re: EJB-QL LIKE clause
              sramsden

              I had success when using XDoclet (EJBDoclet) with the following...

              * @ejb:finder
              * signature="java.util.Collection findByLastNameLike(java.lang.String lastName)"
              * query="SELECT OBJECT(p) FROM Person AS p WHERE p.lastName LIKE '?1'"


              Note the "'" around the ?1, without them you get an error something to do with it expecting a STRING_LITERAL

              • 19. Re: EJB-QL LIKE clause

                I think the error message is prior to any query parsing.
                It simply discard the jboss-ql tag.

                Is the version of JBoss used a problem ?
                As I told, i'm using a binary downloaded from the JBoss site in the beginning of April.

                INFO [Server] JBoss (MX MicroKernel) [3.0.0beta Date:200202210220]

                thx,
                ionel

                • 20. Re: EJB-QL LIKE clause
                  garyls

                  This is what works for me!

                  ejb-jar.xml

                  <query-method>
                  <method-name>findByNamePrefix</method-name>
                  <method-params>
                  <method-param>java.lang.String</method-param>
                  </method-params>
                  </query-method>
                  <result-type-mapping>Local</result-type-mapping>
                  <ejb-ql><![CDATA[]]></ejb-ql>


                  jbosscmp-jdbc.xml

                  <query-method>
                  <method-name>findByNamePrefix</method-name>
                  <method-params>
                  <method-param>java.lang.String</method-param>
                  </method-params>
                  </query-method>
                  <jboss-ql>
                  <![CDATA[select object(c) from Client c where c.name like ?1]]>
                  </jboss-ql>


                  If this does not work then there may be other setup issues involved.

                  Cheers
                  Gary

                  • 21. Re: EJB-QL LIKE clause

                    I'm facing a strange problem :

                    i have removed the description line between the opening query tag and the query-method section tag.

                    Since the beginning it says that the jboss-ql tag (following the query-method tag) is not allowed here blah blah blah.
                    Now, Ladies and Gentlemen, it's the query-method tag which is not allowed here.

                    i'm using the doctype at "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd" and the printed version of May, 16th clearly allows an optional description tag, a non-optional query-method tag, an optional xxx-ql declaration and an optional read-ahead tag.

                    as I told to sramsden, i'm using a binary downloaded in the beginning of April.

                    INFO [Server] JBoss (MX MicroKernel) [3.0.0beta Date:200202210220]

                    does any JBoss developper know if this version works with jboss-ql ?

                    thx,
                    ionel

                    nota : anyway, thanks Gary !

                    • 22. Re: EJB-QL LIKE clause
                      dsundstrom

                      Since this is working for everyone else, I suggest that you download the newest release (rc3) and try again. If it still doesn't work, so the standard debug thing and comment out stuff until it starts to work.

                      1 2 Previous Next