Use of LIKE in EJBQL

Discussions

EJB programming & troubleshooting: Use of LIKE in EJBQL

  1. Use of LIKE in EJBQL (5 messages)

    Hi,
    can any body tell me how do we fetch data from the database which starts from any character
    means
    How Like operator works in EJBQL
    i want to find some records which starts from some character so how can i fetch them

    thanks
    vikassheelgupta

    Threaded Messages (5)

  2. Use of LIKE in EJBQL[ Go to top ]

    Hello Vikas

    A normal EJB-QL statement looks like that:
    select OBJECT(a) from schema a where a.recordName like ?1

    as far as I know, you can't use wild-cards in EJB-QL but you can use it in the parameter of your finder-method:

    Call of finder-method in your client-class (or wherever):

    Collection collection = beanInstance.findByRecordNamePattern("A%");

    it finds all records that begin with 'A'

    Cheers,
    Joerg
  3. container specifc[ Go to top ]

    as i know by the standards of ejbql it is not possible.
    some containers like weblogic allows to write this kind of queries but no idea about orion
  4. Use of LIKE in EJBQL[ Go to top ]

    Hi,
    Thanks for your views
    but how can i implement this because if i use through parameter in orion it is not possible to pass from parameter if i will do in such a manner then i will create exception
    so can any one tell me how to solve this problem

    thanks in advance
    byeeeeeeeeeeeee
  5. How much rows?[ Go to top ]

    How many rows you have in the table?
    Conceptually you should use a finder to filter most and write the like logic in the middlewar? If you have a million then my friend this will be a killer in the first time.

    Try your luck with this kind of query in Orion.

        <weblogic-query>
          <description>find the all the accounts with account type</description>
          <query-method>
            <method-name>findAllAccounts</method-name>
              <method-params>
                <method-param>java.lang.String</method-param>
              </method-params>
          </query-method>
          <weblogic-ql><![CDATA[SELECT OBJECT(a) FROM AccountsBean AS a WHERE a.accountType LIKE ?1]]></weblogic-ql>
        </weblogic-query>
  6. How much rows?[ Go to top ]

    Hello sir,
    that you very much for my help
    and yeah i know it works exactly in weblogic but if we talk about orion or JDeveloper then it didnt works so tell me how to solve it in JDeveloper so that i can solve it
    thanks in advance