How to write EJB-QL query with IN notation and list values EJB3.0?

hi,
I would like to write an EJB-QL query where the query would return the objects whose name equals to one of the names in the list.
SELECT DISTINCT OBJECT(feature) FROM MAPSHEET_LOCK feature WHERE feature.name IN ?1
For ?1 I would like to pass in a list. How can I write this query?
Thanks

List<String> names;
StringBuilder sb = new StringBuilder("SELECT DISTINCT OBJECT(feature) FROM MAPSHEET_LOCK feature WHERE feature.name IN (");
String separator = "";
for (String name : names) {
  sb.append(separator);
   sb.append("'");
   sb.append(name);
   sb.append("'");
   separator = ", ";
sb.append(")");
String ejbql = sb.toString();
// Code for execute query
....Message was edited by:
Rulas

Similar Messages

  • How to write XSJS Select Query with input parameters

    Hello Experts,
    I am creating a xsjs file and in that file I am trying to write a Select Query based on a Calculation View
    I have tried it the following way:
    var query = 'SELECT TOP 100 \"Name\", \"Address\", \"City\", \"Country\" FROM \"_SYS_BIC\".\"Test.HL/AddressView\"'
        + 'WITH PARAMETERS(\'PLACEHOLDER\' = (\'$$P_Name$$\', \' Akhil \'),'
      + '\'PLACEHOLDER\' = (\'$$P_City$$\', \' Lucknow \'))';
    But it gives me the "Mixed spaces and tabs error".
    How should I write XSJS Select Query with input parameters?
    Regards,
    Rohit

    >But it gives me the "Mixed spaces and tabs error".
    Mixed spaces and tabs has nothing to do with the syntax of the statement. You used both spaces and the tab in the content - which JSLint doesn't like.  Remove the beginning spaces of each line and use only one or the other.
    The actual syntax of your statement doesn't look right.  The problem is that you are escaping the \ when you don't need to if you are using ' instead of " for your string.  You escape with \" in the first line but then escape with \' in the 2nd and 3rd line.  That is going to cause serious parsing problems with the command.

  • How to write the select query with complex where condition

    Hi all,
    Can u help me in writing  following select query.
    select * from zu1cd_corr where time_stamp between firstday and lastday .
    In the above query time_stamp contains the date and time.
    where as firstday and lastday contains the dates.
    I need to compare the date in the time_stamp with the firstday and lastday.
    But time_stamp contains the time also and it is char of 14 characters length.

    Hi,
    If that is the case u can do as advait specified....
    if the firstday and secondday are select-options then declare two more variables having 14 character length and then concatenate '000000' to firstday variable and '240000' to last day variable and then write ur query.
    CLEAR : lv_firstday,
                 lv_lastday.
    concatenate firstday '000000' to lv_firstday.
    concatenate lastday '240000' to lv_lastday.
    ranges : r_Date for zu1cd_corr-time_stamp.
    r_date-sign = 'I'.
    r_date-option = 'BT'.
    r_Date-low = lv_firstday.
    r_Date-high = lv_lastday.
    append r_date.
    select * from zu1cd_corr  into table it_zu1cd_corr where time_stamp in  r_Date.
    I hope it helps.
    Regards,
    Nagaraj

  • Query with group by and max value

    Hi,
    I have a table with many values of VAR_TRIMESTRALE for each COD_ISIN so I would take only the rows, for each COD_ISIN, that have the maximum of VAR_TRIMESTRALE.
    select *
    from spr_isin_drm_to b
    group by b.COD_ISIN
    having max(b.VAR_TRIMESTRALE)
    I have tried to write the query in this way but it's wrong.
    How can I write the correct query?
    Thanks, bye bye.

    Hi,
    This is an example of a "Top-N" query:
    SELECT   *       -- or list, if you don't want to see r_num
    FROM    (
            SELECT  b.*
            ,       RANK () OVER
                        ( PARTITION BY  cod_isin
                          ORDER BY    var_trimestrale   DESC
                        )  AS r_num
            FROM    spr_isin_drm_to    b
    WHERE   r_num = 1
    ;

  • Srvrmgr syntax: how can I create Named Subsystem with both Name and Description values?

    In looking through bookshelf, there is no syntax discussed that allows you to include both the Name value and the Description value for a Named Subsystem/Profile Configuration.  In the screenshot, the circled values were created with the server manager command-line.
    In contrast, you can create a component definition with a Name (full name) and Description.
    For CompDef, this works:
    create component definition CompDefTest1_enu for component type AppObjMgr component group Fins run mode Interactive full name "Test Comp Def Test 1" description "Test 1 Object Manager CompDef"
    For Named Subsytem, this does NOT work:
    create named subsystem Test5 for subsystem EAITransportDataHandlingSubsys full name "Test 5" description 'Test 5 Description'
    Can anyone tell me if, for a Named Subsytem, there is a proper syntax to include both the Name and Description values in the command-line, or is the only way to manually create it in the UI?

    Hi,
    I have reviewed the help for create command in srvrmgr, it does not give the full name and description as parameters for subsystem creation. However, as you indicated these parameters are available for component definition creation:
    srvrmgr> help create
      create { component group | compgrp } <component group name>
           [ full name <descriptive name> ]
           [ { description | desc } <description of component group> ]
      create { component definition | compdef } <component definition name>
           for { component type | comptype } <component type name>
               { component group | compgrp } <component group name>
           run mode { batch | interactive | background }
           [ full name <descriptive name> ]
           [ { description | desc } <description of component definition> ]
           [ with [param <param_name>=<value>[, <param_name>=<value>...]]
                  [fixparam <fixed_param_name>=<fixed_value>[,...]]]
      create named subsystem <named_subsystem_name> for
           subsystem <subsystem_name> with <param_name>=<param_value> [, ..]
    Bookshelf also has an example of subsystem creation that does not include full name and description:
    http://docs.oracle.com/cd/E14004_01/books/StoreFwdMsg/StoreFwdMsg_InstallConfig14.html#wp1351472
    In this case I suggest you to create a ticket on My Oracle Support to confirm that srvrmgr does not support creating a new subsystem with full name and description parameters, and request an enhancement request for these parameters to be included in create statement for new subsystems when using srvrmgr.
    Hope it helps,
    WSiebel

  • How to write the below query with parameter and is null

    Hi, I need to retrive the data if the parameter is passed on the field, else retrive all records whose field is null
    Example
    CREATE TABLE DEPT
           (DEPTNO NUMBER(2),
            DNAME VARCHAR2(14),
            LOC VARCHAR2(13) );
    INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
    INSERT INTO DEPT VALUES (20, 'RESEARCH',   'DALLAS');
    insert into dept values (30, 'SALES',      'CHICAGO');
    INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');
    alter table dept add(object_id number);
    insert into dept values (50, 'OPERATIONS', 'BOSTON',1);
    insert into dept values (60, 'OPERATIONS', 'BOSTON',1);
    INSERT INTO DEPT VALUES (70, 'OPERATIONS', 'BOSTON',2);
    select * from dept where object_id =:p_object_id
    If i pass the object_id as 1 , it shloud retrive the values of dept with object_id 1, but if i dont pass the object_id, it should retrive all the records whose object_id is null
    IF 1 is passed, as object id , it should retrive, 50, 60, if 1 is not passed as object_id it should retive 10,20,30,40
    It works fine for me seperately as,
    select * from dept where object_id =:p_object_id -- 1
    select * from dept where object_id is null;
    Is this possible to do in single query.
    Thanks

    SELECT *
    FROM dept
    WHERE object_id = :p_object_id
    OR (object_id is null and :p_object_id is null)
    is one approach.  It's a bit verbose but the meaning is clear.  If you can identify a value that would never appear in the data (-1 for example)
    WHERE nvl( object_id, -1 ) = nvl(p_object_id, -1 );
    Justin

  • SQL QUERY How to write a sql query with a complex where clause.

    I would like to get a list of all my invoices from the past year plus any open invoices that are more than a year old.
    I don't want any overlapping rows.
    Debra has a question

    Debra,
    Sorry but you have posted to a forum that deals exclusively with questions/issues about customizing and programming Microsoft Project, a planning and scheduling application. I suggest you delete this post and find a more appropriate forum.
    John

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • How can I create a query with tables in INFOSET?

    Dear Gurus,
    How can I create a query with tables in INFOSET?
    Just tables and fields INFOSET?
    Kind Regards,

    Hello
    Check following SCN Article for your understanding/reference:
    - [Using Infoset Query ,SAP Query and Quick Viewer|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10eab7af-0e54-2c10-28a5-87b47adbe1a5]
    Regards
    JP

  • How can I create a query with web service data control?

    I need to create a query with web service data control, in WSDL, it's query operation, there is a parameter message with the possible query criteria and a return message contains the results. I googled, but cannot find anything on the query with web service. I cannot find a "Named Criteria" in web service data control like normal data control. In Shay's blog, I saw the topics on update with web service data control. How can I create a query with web service data control? Thanks.

    Hi,
    This might help
    *054.     Search form using ADF WS Data Control and Complex input types*
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html

  • How to write export dump commad with no datable data only table structure.

    How to write export dump commad with no datable data only table structure will there and command for hole schma.
    e.g. export dump command for scott schema and all table within scott schema in it no table data should be exported.

    If I understand the question, it sounds like you just need to add the flag "ROWS=N" to your export command (I assume that you're talking about the old export utility, not the Data Pump version).
    Justin

  • How to write the given query using 'ANY ' operator

    Hi,
    How to write the given query using 'ANY ' operator , I dont need to fetch to grade_master table twice in database, just need to fetch within the result set.
    SELECT dsg_code,dsg_name,dsg_grade FROM designation_master WHERE dsg_orgn='&&Orgn' and dsg_ctry='&&ctry'
    And dsg_loc ='&&loc' And dsg_oru = '&&oru' and dsg_grade in decode('&&radio_group',
    1, SELECT grd_code FROM grade_master WHERE grd_osm_code in (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&Orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'),
    2, SELECT grd_code FROM grade_master WHERE grd_osm_code > (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' and grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code),
    3, SELECT grd_code FROM grade_master WHERE grd_osm_code < (Select grd_osm_code FROM grade_master WHERE grd_orgn='&&orgn' and grd_ctry='&&ctry' And grd_loc ='&&loc' And grd_oru = '&&oru' and grd_code ='&&emp_grade'))
    thanks
    rincy

    Hi,
    One thing I understood my your issue is you want to perform, execution of query once or fetch the results sets my minimizing the number of times executions of queries. It would be hard for us to check in this way, atleast provide some temporary data and some business rules. Only I can IN, >, < (queries logical conditons on inner query)
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

  • 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

  • Query with MARA MVKE and MAST

    Hi
      Im trying to create a query with MARA, MVKE and MAST tables. If corresponding records exist in all the 3 tables, I get output. Otherwise, I get the result as 'No data selected'. I tried using left outer join with MAST , tried using MARC also between MARA and MAST but its of no use. Please suggest how I can both get the sales data and BOM details in the output.
    Thanks
    Aparna

    Hi Aparna,
    Goto  SE16 Check in table,
    1.KDST -
    Sales order to BOM link
    2.STKO -
    BOM - header
    3.STPO -
    BOM - item
    And also you create a query and check the out put.

  • Absolute dynamic select query with dynamic join and where

    Has anyone ever tried creating an absolutely dynamic SELECT query with dynamic Join and Where conditions.
    I have a requirement of creating such a query in an Utility Class, and i have written the code. But its throwing my sysntax errors.
    Please let me know where am I going wrong OR is it really possible to create such a dynamic Query??
        SELECT (FIELDS) INTO TABLE IT_TABLES
          FROM ( (ME->TABLE1)  inner join ( me->table2 )
          on ( on_condition ) )
          WHERE (me->where_fields).
    Ags.

    It worked for me in a following way:
    select * into corresponding fields of table <result_table>
            from (join_string)
            where (l_where).
    Where the contents of join_string were dynamically build using concatenation. So it will be something like
    concatenate ME->TABLE1 'as a INNER JOIN' me->table2 'as b ON (' into join_string separated by space.
    <...>
    add here matching/reference colums, something like
    concatenate 'a~' me->TABLE1_JOIN_COL into temp1.
    concatenate 'b~' me->TABLE2_JOIN_COL into temp2.
    concatenate join_string temp1 '=' temp2 into join_string separated by space.
    <...>
    concatenate join_string ')' into join_string separated by space.
    And then use similar approach for l_where variable.

Maybe you are looking for

  • Cannot start WebLogic Managed Server

    Hi, I have an weblogic domain on a physical machine with two servers (AdminServer and osb_server1 [Managed Server]). (Weblogic 10.3.6) I started nodeManager and enrolled the domain using nmEnroll command through WLST. I can start "AdminServer" thourg

  • Sending CRM survey templates to Mobile handheld using Mobile infrastructure

    Hi, I have a a requirement to send survey templates to handheld client using mobile infrastructure. Also the survey results have to be send from handheld client to CRM using the mobile infrastructure. Has anybody send CRM objects using mobile infratr

  • HTTP Query String

    We use mod_plsql to create webpages. One annoying charactersitic of this framework is having to explicitly define all Query String parameters that a procedure could possibly accept. We have some jquery stuff we're developing that retrieves data from

  • [svn:fx-trunk] 10269: Changing default for -enable-runtime-design-layers to true.

    Revision: 10269 Author:   [email protected] Date:     2009-09-15 10:46:10 -0700 (Tue, 15 Sep 2009) Log Message: Changing default for -enable-runtime-design-layers to true.  The flag may still be used to disable processing of design layer instances if

  • Photoshop Elements on Lenovo Thinkpad2

    Dear All, I am thinkng of purchasing a Thinkpad2. All seems great, but we have a copy of the Photoshop Elements which we really love. I was hoping that we could load the program onto the Thinkpad (and transfer the license of course). The page below m