EJB3 QL - Selecting with wildcards and parameters

Hi,
Can you please help me create a select query which takes parameters and uses wildcards.
QL:
(List<SubjectEntity>) entityManager
.createQuery("{color:#000080}*SELECT aE FROM SubjectEntity aE WHERE aE.name like :word*{color} ")
.setParameter("word", word)
.getResultList();
I pass Corporate* to my word parameter and my TABLE has a row that contains Corporate Finance as a name and I want it matched by the parameter.
Below is an equivalent statement using SQL*
DB:
SELECT * FROM SUBJECT WHERE NAME LIKE(%?%)
Thanks.

One quick fix is in the DAO method where you invoke the query, append a '%' to the end of the word before passing it to the query.
.setParameter("word", word + '%')

Similar Messages

  • Multiple selection with wildcard in WAD

    Hello,
    How can I do filtering with multiple selection with wildcard in WAD 7 ?
    We have this problem in two seperate situation. The first is in the parameter screen where we want to filer the output with two wildcard. The first one we can put on the field and then go to the selection screen but what about the other ????. The second situation is in the report when we want to filter one of the columns with wildcard.
    I will appreciate if someone will open my eyes about this.
    Ilan

    Hello,
    you can use the * for wildcards in the BEx Web.
    For example 37* -> 370000 up to 379999.
    Buy,
    André

  • Enhancing Customer Reports with Commands and Parameters

    Hi All,
    I am implementing the mentioned tutorial. I have succesfully deployed the AccessStatisticApplication PAR on portal. While scheduling the report from Content Management -> Reports -> Running Reports, it is giving error "<b>Can't find bundle for base name com.sap.netweaver.km.stats.reports.DocumentAccessReport, locale en_US</b>". Has anyone faced the problem, can anyone please help to remove this runtime error.
    Related Link: <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7d28a67b-0c01-0010-8d9a-d7e6811377c0">Enhancing Customer Reports with Commands and Parameters</a>
    Regards
    Poonam

    <i>True, the application property service is apparently not to be used for a real-life scenario</i>
    You can definitely use the application property service in production scenarios - it's used by other components in a standard KM install, i.e. out-of-the-box.
    <i>in our case it forced the server down with deadlocks. </i>
    This should definitely not happen! Did you get SAP support to take a look at this? Was it the most popular documents report that caused this, or some other custom code? There should be no such problem with this service, since it's been around for quite some time and in production use.
    <i>
    Even if the code sample is not to be used for real-life scenarios it could at least make use of something else than the application property service which isnt't optimal for this use.
    </i>
    The application property service is good for a lot of scenarios, so it is realistic to use in in real-life scenarios. The only time I have seen this approach (storing the number of hits on documents in the database) fail is in very high-load scenarios.
    <i>Could you provide me with a link to the documentation for the logging framework?</i>
    <a href="http://http://help.sap.com/saphelp_nw70/helpdata/en/d2/5c830ca67fd842b2e87b0c341c64cd/frameset.htm">Logging and Tracing</a> on help.sap.com and <a href="https://help.sap.com/javadocs/NW04S/current/en/index.html">Logging and Tracing API (J2EE Engine API)</a> for NW 7.0.

  • How to create a link with 2 choices in Xcode: one selected with UICollectionViewController and the other with UITableViewController

    Hi
    I want to create a app redirecting to my mebsite.This app permit to select a "area" selected on a UICollectionViewController, and an "event" selected with a UITableViewController.
    I need to integer both informations on the FinalViewController (called in my app AnnoncesViewController) =>
    The fisrst array is selected on CollectionViewController:@"http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=e vents&Itemid=0&ohanah_venue_id=21"
    The second array is selected onUITableViewController:@"&ohanah_category_id=1&textToSearch="
    The final array must be:http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=eve nts&Itemid=0&ohanah_venue_id=21&ohanah_category_id=1&textToSearch=
    How can I integer these 2 NSArray to obtain this result to link  to a UIWebView as FinalViewController?
    Thank you for your help!!
    My App is on Drobox:https://www.dropbox.com/s/43l1p2hj5bqamvn/Carnet%20du%20Jour.zip
    Gracefully
    RémySpehler

    Hi
    I want to create a app redirecting to my mebsite.This app permit to select a "area" selected on a UICollectionViewController, and an "event" selected with a UITableViewController.
    I need to integer both informations on the FinalViewController (called in my app AnnoncesViewController) =>
    The fisrst array is selected on CollectionViewController:@"http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=e vents&Itemid=0&ohanah_venue_id=21"
    The second array is selected onUITableViewController:@"&ohanah_category_id=1&textToSearch="
    The final array must be:http://carnet-du-jour.com/index.php/component/ohanah/?option=com_ohanah&view=eve nts&Itemid=0&ohanah_venue_id=21&ohanah_category_id=1&textToSearch=
    How can I integer these 2 NSArray to obtain this result to link  to a UIWebView as FinalViewController?
    Thank you for your help!!
    My App is on Drobox:https://www.dropbox.com/s/43l1p2hj5bqamvn/Carnet%20du%20Jour.zip
    Gracefully
    RémySpehler

  • Select with transposition and join

    Hi Guys!
    I'm using Oracle 9i and I'm facing the following problem:
    My table looks like this:
    Stripe
    Unit
    Value
    1
    1
    a1
    1
    2
    a2
    1
    3
    a3
    2
    1
    b1
    2
    2
    b2
    2
    3
    b3
    2
    4
    b4
    4
    1
    c1
    4
    2
    c2
    4
    3
    c3
    4
    4
    c4
    4
    5
    c5
    My result should look like this:
    Unit
    Stripe1 Value
    Stripe2 Value
    Stripe3 Value
    Stripe4 Value
    1
    a1
    b1
    c1
    2
    a2
    b2
    c2
    3
    a3
    b3
    c3
    4
    b4
    c4
    5
    c5
    I tried it with one select for each stripe and full joins, but in this example I would only see the first 3 units....
    Any ideas?

    Another way, but only if your on database version 11gR1 and onwards, is to use the PIVOT operator:
    SQL> -- generating sample date:
    SQL> with t as (
      2  select 1 stripe, 1 unit, 'a1' value from dual union
      3  select 1, 2, 'a2' from dual union
      4  select 1, 3, 'a3' from dual union
      5  select 2, 1, 'b1' from dual union
      6  select 2, 2, 'b2' from dual union
      7  select 2, 3, 'b3' from dual union
      8  select 2, 4, 'b4' from dual union
      9  select 4, 1, 'c1' from dual union
    10  select 4, 2, 'c2' from dual union
    11  select 4, 3, 'c3' from dual union
    12  select 4, 4, 'c4' from dual union
    13  select 4, 5, 'c5' from dual
    14  )
    15  --
    16  -- actual query:
    17  --
    18  select *
    19  from ( select unit
    20         ,      stripe
    21         ,      value
    22         from   t
    23       )
    24  pivot (max(value) for (stripe) in ( 1 as stripe1value
    25                                    , 2 as stripe2value
    26                                    , 3 as stripe3value
    27                                    , 4 as stripe4value
    28                                    )
    29        )
    30  order by unit;
          UNIT ST ST ST ST
             1 a1 b1    c1
             2 a2 b2    c2
             3 a3 b3    c3
             4    b4    c4
             5          c5
    5 rows selected.
    ORACLE-BASE - PIVOT and UNPIVOT Operators in Oracle Database 11g Release 1

  • Can oracle search with wildcard(%) and decimal point(.)

    I created number of filed like test1.2.1, test1.2.2 and test1.2.3, when conduct a search in the database ADV( test1.% ) the search returned with zero results. can oracle search work on the above scenario?

    Cannot reproduce what you have said (or may be I have misunderstood your requirement).
    SQL> select * from
      2  (select 'test1.2.1' field from dual
      3  union all
      4  select 'test1.2.2' from dual
      5  union all
      6  select 'test1.2.3' from dual
      7  union all
      8  select 'test2.2.1' from dual
      9  union all
    10  select 'test2.2.2' from dual)
    11  where field like 'test1.%'
    12  ;
    FIELD
    test1.2.1
    test1.2.2
    test1.2.3

  • Requiring selection with cfform and cfselect

    I would like to have CF enforce the required="yes" attrribute
    of the cfselect tag as the documentation says it should. I've seen
    this discussed before here, but no resolution. The documentation of
    the required parameter says:
    ============ quoted text ============================
    * Yes: a list element must be selected when the form is
    submitted.
    Note: This attribute has no effect if you omit the size
    attribute or set it to 1, because the browser always submits the
    displayed item. You can work around this issue: format forms by
    having an initial option tag with value=" " (note the space
    character between the quotation marks).
    ============ end quoted text =========================
    Yet it does not work. I can use additional javascripts,
    validate on server side, etc., but I would like it to work as the
    documentation says. Or to know why the documentation continues to
    say it will work, if it won't.
    Thanks!
    Code below:

    Try putting in the closing tag
    <option value=" "> </option>
    Ken

  • How to create VO with multiple dynamic where clauses on select with UNION?

    I am trying to implement the View Object for the UNION query that looks like this:
         select a,b,c...
              from t1,t2,...
              where dynamic_where_clause1     
         union all
         select a,b,c,...
              from t11,t12, ...
              where dynamic_where_clause2
    There are up to 60 input parameters that are used to generate dynamic where clauses. They are actually created by calling PL SQL function.
    So far, I was not able to assign both where clauses to the view object. Is there a workable solution for this problem, besides resorting to programmatic View Object?
    I understand that recommended way with UNIONs is to wrap both queries into a parent select:
    select * from (
         select a,b,c...
              from t1,t2,...
              where ... -- table relationship joints
         union all
         select a,b,c,...
              from t11,t12, ...
              where ... -- table relationship joints
    ) QRSLT
         where dynamic_where_clause
    Unfortunately this approach doesn't work here, since individual selects are producing unmanageable amount of data and resulting query takes forever to complete.

    I afraid I would not have any real benefits from using VO if I replace the entire query with every request. Actually, the performance may suffer.
    I solved the problem by creating a POJO Data Control and invoking the custom select query from java. Not sure if it is the best approach to the problem, but implementation time is limited and it works.
    Actually, this is not the first time I see the need to implement VO with complicated SQL like select with unions and dynamic pieces. It would be nice to find a solution and not resort to workarounds.
    Edited by: viksicom on Aug 2, 2012 8:48 AM

  • Problems with videos and music requires restore

    I have a 30GB Video and in general everything works fine. However, I have had to restore the device 4x since Christmas due to the following;
    When I select a video, the display shows the play icon and battery icon then goes blank and returns to the list of videos and/or when selecting a song, it displays the song I selected (with artwork) and then scrolls through the list of songs in that play list and does nothing.
    I can resolve the issue by restoring and syncing, but the problem eventually returns.
    5th Generation 30GB Video   Windows XP   USB connection

    In case anyone else has this issue, I found the solution. The problem was caused by my earbuds. I bought a new pair and that fixed the problem.

  • How do I create a folder or report from a query with a union and parameters

    I have created folders with unions but I am having difficulty coverting a query with a union and parameters.
    The following works great in SQL*Developer without parameters, but I want to change to use parameters for the year and quarter and use it in Discoverer:
    SELECT TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000') FEID,
      AV.FIRM_NAME VENDOR_NAME,
      AV.BIDCLASS CONTRACT_CODES,
      AV.AWAMT AWARD_AMOUNT,
      AV.SOL_MODE FORMAL_INFORMAL,
      AV.CERT BUSINESS_ENTITY,
      AV.ETHNICITY ETHNICTY,
      AV.PO_NUMBER_FORMAT CONTRACT,
      SUM(VP.INVOICE_AMOUNT) AMOUNT_PAID_$
    FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV,
      CONFIRM.VSTATE_VENDOR_PAYMENTS VP
    WHERE ( ( AV.PO_NUMBER = VP.PO_NUMBER
    AND AV.VENDOR_ID       = VP.VENDOR_ID ) )
    AND (TO_CHAR(VP.PAYMENT_DATE,'Q') = '4')
    AND ( TO_CHAR(VP.PAYMENT_DATE,'YYYY') = '2009' )
    GROUP BY TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000'),
      AV.FIRM_NAME,
      AV.BIDCLASS,
      AV.AWAMT,
      AV.SOL_MODE,
      AV.CERT,
      AV.ETHNICITY,
      AV.PO_NUMBER_FORMAT
      union
    SELECT TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000') FEID,
      AV2.FIRM_NAME VENDOR_NAME,
      AV2.BIDCLASS CONTRACT_CODES,
      AV2.AWAMT AWARD_AMOUNT,
      AV2.SOL_MODE FORMAL_INFORMAL,
      AV2.CERT BUSINESS_ENTITY,
      AV2.ETHNICITY ETHNICTY,
      AV2.PO_NUMBER_FORMAT CONTRACT,
      0 AMOUNT_PAID_$
    FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV2
    WHERE
    not exists (SELECT 'X'
                  FROM CONFIRM.VSTATE_VENDOR_PAYMENTS VP2
                 WHERE av2.po_number = vp2.po_number
                       AND (TO_CHAR(VP2.PAYMENT_DATE,'Q') = '4')
                       AND ( TO_CHAR(VP2.PAYMENT_DATE,'YYYY') = '2009' ))
    AND (TO_CHAR(AV2.AWDATE,'Q') = '4')
    AND (to_CHAR(AV2.AWDATE,'YYYY') = '2009')
    GROUP BY TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000'),
      AV2.FIRM_NAME,
      AV2.BIDCLASS,
      AV2.AWAMT,
      AV2.SOL_MODE,
      AV2.CERT,
      AV2.ETHNICITY,
      AV2.PO_NUMBER_FORMAT Can someone provide a solution?
    Thank you,
    Robert

    Hi,
    You can take the parameters to the select so that you will be able to create conditions over them.
    Try to use this SQL instead of your and in the discoverer workbook create the conditions and parameters:
    SELECT TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000') FEID,
    AV.FIRM_NAME VENDOR_NAME,
    AV.BIDCLASS CONTRACT_CODES,
    AV.AWAMT AWARD_AMOUNT,
    AV.SOL_MODE FORMAL_INFORMAL,
    AV.CERT BUSINESS_ENTITY,
    AV.ETHNICITY ETHNICTY,
    AV.PO_NUMBER_FORMAT CONTRACT,
    TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
    TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
    SUM(VP.INVOICE_AMOUNT) AMOUNT_PAID_$
    FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV,
    CONFIRM.VSTATE_VENDOR_PAYMENTS VP
    WHERE ( ( AV.PO_NUMBER = VP.PO_NUMBER
    AND AV.VENDOR_ID = VP.VENDOR_ID ) )
    --AND (TO_CHAR(VP.PAYMENT_DATE,'Q') = '4')*
    --AND ( TO_CHAR(VP.PAYMENT_DATE,'YYYY') = '2009' )*
    GROUP BY TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000'),
    AV.FIRM_NAME,
    AV.BIDCLASS,
    AV.AWAMT,
    AV.SOL_MODE,
    AV.CERT,
    AV.ETHNICITY,
    AV.PO_NUMBER_FORMAT ,
    TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
    TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
    union
    SELECT TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000') FEID,
    AV2.FIRM_NAME VENDOR_NAME,
    AV2.BIDCLASS CONTRACT_CODES,
    AV2.AWAMT AWARD_AMOUNT,
    AV2.SOL_MODE FORMAL_INFORMAL,
    AV2.CERT BUSINESS_ENTITY,
    AV2.ETHNICITY ETHNICTY,
    AV2.PO_NUMBER_FORMAT CONTRACT,
    TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
    TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
    0 AMOUNT_PAID_$
    FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV2
    WHERE
    not exists (SELECT 'X'
    FROM CONFIRM.VSTATE_VENDOR_PAYMENTS VP2
    WHERE av2.po_number = vp2.po_number
    AND (TO_CHAR(VP2.PAYMENT_DATE,'Q') = TO_CHAR(VP.PAYMENT_DATE,'Q') )
    AND ( TO_CHAR(VP2.PAYMENT_DATE,'YYYY') = TO_CHAR(VP.PAYMENT_DATE,'YYYY') ))
    --AND (TO_CHAR(AV2.AWDATE,'Q') = '4')*
    --AND (to_CHAR(AV2.AWDATE,'YYYY') = '2009')*
    GROUP BY TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000'),
    AV2.FIRM_NAME,
    AV2.BIDCLASS,
    AV2.AWAMT,
    AV2.SOL_MODE,
    AV2.CERT,
    AV2.ETHNICITY,
    AV2.PO_NUMBER_FORMAT,
    TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
    TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
    Tamir

  • Select-options and parameters

    hi,
    In How many ways we can define select-options and parameters.

    hi uday,
    Usually we use PARAMETERS for single value input and
    SELECT-OPTIONS is used to give a range of input values for a single field
    SELECT-OPTIONS implicitly consists of internal table with fields
    OPTIONS
    LOW
    HIGH
    SIGN
    eg:
          DATA: G_VBELN TYPE VBAK-VBELN.
          SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
          PARAMETERS : P_VBELN LIKE VBAK-VBELN.
          SELECT-OPTIONS: S_VBELN FOR G_VBELN.
          SELECTION-SCREEN END OF BLOCK B1.
       o/p:
              P_VBELN: _________________.
             S_VBELN:___________ TO  ____________.
    reward if helpful
    regards.
    shashikanth naram.

  • HI major diffrence in select-options and parameters

    Hi,
      Can any one explain me the major diffrence between select options and parameters.
    I know that in select options we can give a range of values and in parameter one value.
    Thanks

    Hello Hari,
    I would see following differences:
    1. As you have mentioned, many values/ranges can be given in the SELECT-OPTIONS. However, the parameter can hold only one value.
    2. In the run time, we see the data w.r.t a select option as an Internal table and Parameter may be accessed as a global variable.
    3. Consider following statements:
       a. select-options: s_matnr for mara-matnr no-extension no intervals.
       b. parameters: P_MATNR like mara-matnr.
    Both the statements look same on the selection screen.
    consider the SQLs:
    <b>select * into corresponding fields of table g_t_mara
    from mara
    where
    matnr in s_matnr.</b>
    and
    <b>select * into corresponding fields of table g_t_mara
    from mara
    where
    matnr eq p_matnr.</b>
    both the SQLs give the same output if the user gives a material number on Selection screen.
    If the user does NOT give any input in selection screen, the first SQL will fetch all data from DB, whereas the SQL with the PARAMETER will fail.
    So I think we should keep in mind the requirement and code accordingly.
    I hope this helps you.
    Best Regards,
    Murugesh AS

  • Is there a way to select MULTIPLE tabs and then copy ALL of the the URLs and titles/or URLs+titles+HTML links? This can be done with the Multiple Tab Handler add on; However, I prefer to use a Firefox feature rather than download an add on. Thanks.

    Currently, I can copy ONE tab's url and nothing else (not its name). Or I can bookmark all tabs that are open. However, I'd like to have the ability to select multiple tabs and then copy ALL of the the URLs AND their titles/or copy ALL of the URLs+titles+HTML links? This can be done with the Multiple Tab Handler add on; when I download the add on, I get a message saying that using the add on will disable Firefox's tab features. I prefer to use Firefox features rather than download and use an add on. Is there a way to do this without an add on?

    Hi LRagsdale517,
    You should definitely be able to upload multiple files by Shift-clicking or Ctrl-clicking the files you want to upload. Just to make sure you don't have an old version of the service cached, please clear the browser cache and then log in to https://cloud.acrobat.com/files. After clicking the File Upload icon in the upper-right corner, you should be able so select multiple files for upload.
    Please let us know how it goes.
    Best,
    Sara

  • I have an iPhone 4 on IOS5. I signed up for itunes match. After everything uploaded to the cloud, my songs are messed up. I'll select a song and the title will show with the right art work but a different song will start playing.  Anyone have a solution?

    I have an iPhone 4 on IOS5. I signed up for itunes match. After everything uploaded to the cloud, my songs are messed up. I'll select a song and the title will show with the right art work but a different song will start playing.  Some songs won't play at all even though they do appear in the itunes store. The artwork almost always shows u blank until you turn it to landscape then it will appear. Anyone know what's going on?

    I have found that scrolling through the album list (past albums without art) triggers the progress wheel next to the wifi symbol. You can scroll quickly through the whole collection and then wait! Artwork will appear gradually...
    However, repeat visits to the Music App might initially show no artwork again, but it might spontaneously appear more quickly this time. The bad news is that the whole Music App is now sluggish as ****...

  • I get a dialogue box asking "What should Firefox do with this file" Options open with or save file. My wife selected save file and now it only opens note pad and displays the text of the file to be saved. OK in windows Internet Explorer.

    I get a dialogue box asking "What should Firefox do with this file" Options open with or save file. My wife selected save file and now it only opens note pad and displays the text of the file to be saved. OK in windows Internet Explorer.

    P.S. Site is http://www.coldwatercreek.com

Maybe you are looking for