JPA: IN parameter to take in a Collection

Hi,
I am wondering whether in latest Toplink Essentials this issue (reproduced below for convenience) https://glassfish.dev.java.net/issues/show_bug.cgi?id=2484 has been fixed:
"For instance, the query "SELECT i FROM Person i WHERE i.address IN
(:collection)"
using setParameter("collection",list)
where list contains multiple strings Results in
"IllegalArgumentException: You have attempted to set a value of type class
java.util.ArrayList for parameter collection with expected type of class
java.lang.String from query"
Even though the spec states that the input parameter must "be like the same
abstract schema type of the state_field_path_expression in type"
TopLink Essentials could be extended to accept a collection containing valid
types. "
Another related discussion: http://forums.sun.com/thread.jspa?threadID=5251067
It does not really matter whether this issue has been fixed or not since I can build my query dynamically. I just need to know whether the fix is already available so that I can justify my solution of expanding the IN parameters manually if someone asked me.
Thank you.

The JPA 2.0 specification has added support for passing collections to IN parameters. We have not yet started this work in our development of the JPA 2.0 reference implementation in the EclipseLink Project.
The JPA 2.0 development status page is available at: http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0
For now you'll need to continue to expand things yourself or build the query using the underlying native API.
Doug

Similar Messages

  • Dynamic parameter takes forever to load

    I have a dynamic parameter that takes forever to load. I made the report using CR11 and that parameter took like a couple of seconds to populate the data. Now I am using CR13 latest version and it takes around 5 minutes to load 50 records.
    Any help will be really appreciate it.

    Hi Otto,
    Does it happen with all reports that have Dynamic Prompts?
    Did you try creating a sample report (maybe against the Xtreme Sample Database) with dynamic prompts and see whether you experience the same behaviour?
    -Abhilash

  • NamedQuery with parameter in IN clause

    Hi
    I need to execute a query like that returns all the files from the types specified in parameter:
    select o from file o where o.id in (:ids)
    tried this :
    Query query = em.createNamedQuery("File.findByFileIds");
    query.setParameter("ids", idlist);
    idlist is of list type.
    but no success.
    thanks for the help.

    Hi,
    A statement like:
    select o from file o where o.id in (:ids) cannot take a value of List<Long> for :ids.
    To pass in multiple values for ids, it would have to be something like this:
    select o from file o where o.id in (:id1,:id2,:id3).
    You can use native query fetaure in JPA to build the query on fly and pass the individual parameter for an item of collection and execute the query.
    Regards,
    Vinay

  • How to pass a Java arraylist as a parameter to a StoredProcedureCall

    I need to invoke a stored procedurecall which takes in a collection parameter represented as a nested table. I need to pass a java ArrayList object to it. How can I pass this parameter to the stored procedure using StoredProcedureCall class.

    Hello,
    Check out
    Is possible to pass array/list as parameter in TopLink StoredProcedureCall?
    for some more information on using VARRAYs in 10.1.3. TopLink 11 has a feature that converts VARRAYs to/from collection types for you. An example using "myProcedure" that has an inout parameter "names" defined as type "NAMELIST_TYPE" would be:
        StoredProcedureCall sqlcall = new StoredProcedureCall();
        sqlcall.setProcedureName("myProcedure");
        sqlcall.addUnamedInOutputArgument("names", "names", Types.ARRAY, "NAMELIST_TYPE", ArrayList.class);
        DataReadQuery query = new DataReadQuery();
        query.addArgument("names");
        query.setCall(sqlcall);
        Vector args = new Vector();
        ArrayList names = new ArrayList();
        names.add("firstname1");
        names.add("firstname2");
        args.add(names);
        //DataReadQuery returns a collection of DatabaseRecords
        results = (Vector)getSession().executeQuery(query, args);
        //getting one record from the list:
        names =((ArrayList)((DatabaseRecord)results.get(0)).get("names"))This is just a simple example. More complex nested types can be done by providing a ObjectRelationalDatabaseField parameter describing the type, but I dont have any examples showing this handy.
    Hope this example helps,
    Chris

  • Need to run the report for All Values when Null is passed in parameter

    Hi All,
    In my BIP report, I am using a parameter :asset with Type as Text, which means user will type the values for the parameter in the text box.
    Now, this parameter can take multiple comma separated values. I have a requirement to run the report for All Values when user doesn't enter any value in the parameter text box and if user enters any value(s) then the report will run for those values . The way, I tried to handle that in the query using couple of ways was :
    IMP : My Database is SQL Server
    where
    (table.asset = isnull((:asset), table.asset) or table.asset in (:asset))
    Now this works fine when I give a single asset number but when I give multiple values separated by comma like 123, 345 in the text box, then the statement fails saying 'encountered ,'
    I also tried simply
    table.asset in isnull((:asset),table.asset) -- but this doesn't work as it doesn't allow me to use in operater while using isnull and if i will use = operater then it won't work in case of multiple values
    Any suggestions on how can I handle this? Any help would be highly appreciated.
    Thanks,
    Ronny

    thanks for replying, but i tried this option too, it did not work for me, neither isnull nor coalesce. I mean, the solution work for single value but when i pass multiple values then separated by a comma then it doesn't work and shows me an error like "Incorrect Syntax ','". I am using SQL server as DB and bip is 10.1.3.4.1
    also please share the SR number, so i can also check the same.
    can there be any other work around to this?
    thanks,
    ronny

  • Parameter based on decode/function field - slow response

    Hi,
    When one of the parameters of a report is used, the report takes a very long time to run. The parameter has a LOV of statuses in Hebrew.
    The folder is a custom folder and the status in Hebrew is a decode field using a function. In other words, it first goes to a function to get the status, and then translates each status (I guess that the Hebrew will be strange but I hope that the general form of the decode is clear):
    DECODE( APPS.JAFI_DISCO_UTILS_PKG.JAFI_GET_INVOICE_STATUS(
    AI.INVOICE_ID,
    AI.INVOICE_AMOUNT,
    AI.PAYMENT_STATUS_FLAG,
    AI.INVOICE_TYPE_LOOKUP_CODE),
    'APPROVED','מאומת',
    'NEVER APPROVED','מעולם לא עבר אימות',
    'NEEDS REAPPROVAL','דורש אימות מחדש',
    'CANCELLED','מבוטל',
    'AVAILABLE','זמין',
    'UNAPPROVED','לא מאומת',
    'SELECTED FOR PAYMENT','נבחר לתשלום',
    'FULL','מיוחס במלואו',
    'UNPAID','לא שולם',' ')
    I am assuming that the reason for the slow response is the constant run of the function in addition to the decode (which I was once told also slows the response a bit).
    Is there anyway to change the sql somewhat? Without using the parameter the report takes about 2 1/2 minutes to run. Using the parameter it takes around 25 minutes to run.
    Thank you.
    Leah
    Edited by: user476771 on May 10, 2010 2:09 AM

    Hi Michael,
    I think your suggestion #3, checking the indexes, is an excellent start.
    As to the other suggestions, I believe that everything passed to the function is needed to find the status.
    We seem to have serious problems running materialized views. Our dba is actually checking it out now. One group of mv were changed a few months ago so that they are no longer needed (someone worked around it using other tables for the data). Another mv is problematic even though it takes 14 minutes to create in a tst environment (which I happen to do yesterday) and causes no problems afterwards, it is a problem when run in prod as part of a job. As I mentioned, our dba is checking it out.
    I hesitate to create a new table that is updated every night with the status of each invoice. It won't be up-to-date during the day, and it means changing the report that has otherwise run smoothly until now. The user avoids using the one parameter as much as possible so it's not THAT bad...
    I really appreciate your giving the four suggestions.
    Thank you so much.
    Leah

  • Export images to a directory structure based on a collection tree?

    A question:
    Will lightroom have the capability to export images to a directory structure which mirrors a collections logical structure?
    The reason I ask this is that when I create websites using third party tools (eg, Jalbum) I typically generate a flash or HTML based site with an menu structure for navigating the images.
    So, the image interface is not simply a "flat-file" display as per the templates in Lightroom beta.
    To do this, with previous image management tools (eg, iMatch) I create a hierarchy of images based on the categories (or collections) that the images are assigned to, export the images in a folder tree reflecting their categories (or collection), then use, say, Jalbum, to generate the website with the menu tree reflecting the folders/images.
    This is extremely useful for more complicated image websites with categories and a large no of images.
    If this function was built into Lightroom I guess it would be in the export function such that the "write to folder" box could take an argument {collection name} which would create a folder tree reflecting the collections logical tree which is being exported.
    Apologies if this topic has been raised previously. But this function is extremely useful if you are using third party html tools or simply building websites by hand.
    Regards
    Alistair

    I started simmilar thread in Lightroom Feature Requests few months ago, but can't find it anymore since new forum version...
    What I can suggest as a new feature is export to directory structure from collections or second option from keywords. Probably more usable and easier to implement would be from collections.
    What I need it to export many photos to different directories pretty often, and this would be great help since I could arrange them in collections and collection sets. Then select collection set and export it in a manner that collection set would be main export directory, and each collection within the set would be exported to its own folder within main collection set export folder.
    This would be much appreciated feature in near future
    Thank you for great product by the way

  • Error creating outbound parameter in WE20

    Hi,
    Recently, I tried to create a new partner profile via WE20 of Type B (Bank) in my QA system. The profile got created, however, I could not create outbound parameters for the same. On clicking the '+' symbol to add the outbound parameter, it takes me to 'Telephony' tab. Even after providing some info in the Telephony tab, it doesn't give me a screen where I can enter the outbound parameter details.
    I have checked and verified my authorization after comparing it with DEV system and found it to be exactly the same. Infact, I have more authorization in QA than in DEV.
    Would someone please help to resolve this issue. Has anyone faced a similar problem before? If yes, how did you resolve it?
    Thanks & Regards,
    Deoraj Alok.

    I had a problem like this years ago.... caused by an inconsitancy but i never could figure out why, i was not able to reproduce it.
    to fix it I had to manually remove the entries from EDP12 EDP13 EDP21 EDIPHONE, ... and recreate it from scratch
    are you able to create another partner profile or not?

  • How can i dynamically select columns based on the input parameter?

    I have an input parameter which takes single numeric value.
    Based on this value i have to dynamically select table-columns .
    For eg: if i have following fields in my table :
    SEM_1
    SEM_2
    SEM_3 and SEM_4.
    And if i give numeric input as 2 , then i have to select "SEM_2" column only.
    if the input is 3 then i have to select "SEM_3" only and leave the rest of the columns.
    how do i achieve this dynamic feature in the "Select .....  From...... table...." statement in the ABAP??

    Hi,
    you should try something like this.
    TYPES: cond(72) TYPE c.
    data: condtab TYPE TABLE OF cond,
             condw type cond.
    data: lv_field(30) type c value 'SEM_'.
    write p_num to lv_field+4(1).
    condw = lv_field.
    append condw to condtab.
    SELECT (CONDTAB) FROM table INTO.....
    Kostas
    Message was edited by:
            Kostas Tsioubris

  • Need info about the parameter _FIX_CONTROL in a BW environment

    Hi ,
    I have done some research about the parameter FIXCONTROL and went through the SAP note 1165319.
    We have a task at hand where SAP has recommended a new value to be added to this parameter in a BW production environment.
    Now in the above note there are an entire set of values which this parameter can take up.
    I have understood to some extent that this has to do with this Fixes if case of any issues.
    last month we have upgraded the oracle version of the database from 10.2.0.2 to 10.2.0.4.
    Can anyone help me in understanding what this MergeFix is all about?
    I need to better understand this concept.
    Thank you.
    Regards,
    Hari Kishan.

    Hello,
    still not sure if I fully understood your question; but the recommended approach regarding patches is:
    1) Apply all the interim patches recommended by SAP. For Oracle 10.2.0.4 these will those from SAP note 1137346. The merge fix from SAP note also 1165319 is mentioneded there.
    And by the way, SAP note 1137346 is updated about once a month; new patches may be added, old ones may be removed. SAP recommends to follow accordingly; but if there aren't any problems, you might want to you keep your current state for a longer period.
    2) Read all the SAP notes mentioned there. You may have to do additional tasks like setting Oracle parameters, FIXCONTROL or others. The value you have to set now may or may not be mentioned in one of these notes, I can't know.
    3) If you encounter some problem, first search in SAP notes, or if necessary open a support call with SAP. You may then have to apply additional patches and set addtional values for FIXCONTROL.
    And yes, this way the list of required patches may become specific to each customer, as customer requirements are specific.
    But it would be difficult to find the exact list of needed patches in advance.
    I think a BW consultant who is familiar with Oracle installations will tell you something similar. One who is very experienced in your scenario might also be able to recommend additional patches in advance.
    regards

  • Received [Microsoft][ODBC SQL Server Driver]Invalid parameter type

    Hi,
    This error happened when I am using CallableStatement
    to call a stored procedure.
    =====================
    cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
    myResultSet = cstmt.executeQuery();
    =====================
    I am sure my stored procedure is returning 'int'.

    Hi,
    Here is the string:
    String procCallstmt = "{?=call stp_CheckLogon(?,?,?)}";
    the last parameter is the OUT parameter, it takes 'int' data type in the stored procedure
    CallableStatement cstmt = Conn.prepareCall(procCallstmt);
         cstmt.setString(1,vStr1);
         cstmt.setString(2,vStr2);
         cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
         myResultSet = cstmt.executeQuery();
    ----------------------------------

  • SCCM 2012 report w/ selectable collection

    I am trying to create a report with a selectable collection parameter.  The original query I'm using is as follows (Stolen from
    http://blogs.technet.com/b/infratalks/archive/2013/09/10/sccm-2012-reporting-get-system-serial-number-amp-create-custom-ssrs-report.aspx):
    Select sys.Name0 Machine, CS.UserName0 'User Name',OS.Caption0 OS, OS.CSDVersion0 'Service Pack',CS.Manufacturer0 Manufacturer,CS.Model0 Model,BIOS.SerialNumber0 'Serial Number',RAM.Capacity0 Memory, cs.SystemType0
    From v_R_System SYS
      left join v_GS_COMPUTER_SYSTEM CS on sys.Name0=cs.Name0
      left join v_GS_PC_BIOS BIOS on sys.ResourceID=bios.ResourceID
      left join v_GS_OPERATING_SYSTEM OS on sys.ResourceID=OS.ResourceID
      left join v_GS_PHYSICAL_MEMORY RAM on sys.ResourceID=ram.ResourceID
      --Where sys.Name0 = @variable
      order by sys.Name0
    This works fine, but it gives me that information for EVERY machine in our infrastructure globally.  I am only interested in getting this information from machines in certain collections and I want to be able to select the collection each time I run
    the report.  I found this article:
    http://it.peikkoluola.net/2013/06/02/report-with-a-selectable-collection-parameter-sql/ and followed the steps, but cannot run the report successfully.  I'm guessing it has something to do with needing to modify my query, but I am a newb with SQL and
    have no clue what or where I should be tweaking.  Just adding "WHERE(dbo.v_FullCollectionMembership.CollectionID
    = @COLLID)" gives me a syntax error.  Moving it above "Order by sys.name0" gives an error about not being bound to anything, which makes sense but as I mentioned, I don't know what to tweak.  Help!  Thanks.

    Select sys.Name0 Machine, CS.UserName0 'User Name',OS.Caption0 OS, OS.CSDVersion0 'Service Pack',CS.Manufacturer0 Manufacturer,CS.Model0 Model,BIOS.SerialNumber0 'Serial Number',RAM.Capacity0 Memory, cs.SystemType0
    From v_R_System SYS
      left join v_GS_COMPUTER_SYSTEM CS on sys.Name0=cs.Name0
      left join v_GS_PC_BIOS BIOS on sys.ResourceID=bios.ResourceID
      left join v_GS_OPERATING_SYSTEM OS on sys.ResourceID=OS.ResourceID
      left join v_GS_PHYSICAL_MEMORY RAM on sys.ResourceID=ram.ResourceID
      join v_fullcollectionmembership fcm on fcm.resourceid=sys.resourceid
      Where fcm.collectionid = @COLLID
      order by sys.Name0
    Try the above, note that @COLLID is a placeholder for a variable.  It is presumed that you are creating this using Report Builder 3.0 (or better) or some other SQL tool to create reports for use on your SRS reporting point.  If you happen
    to be using Report Builder, once you save the above, under parameters you'd have a place for COLLID.  Now, what you want is to be able to have that parameter be populated with your collection names, so that you can select from the list when the report
    is run.
    So... another DataSet, with a query like:
    select collectionid, name
    from v_collection
    order by name
    Then, back to your parameters, COLLID, available values, Get values from a query, and you'll want to use that dataset you just made, and Value field is collectionid, and Label field is Name.
    If you want to test the top query in regular sql, don't use @collID.  figure out the collectionid of a specific collection, and put in where fcm.collectionid='ABC00012'
    Standardize. Simplify. Automate.

  • Regarding UTL_FILE parameter in the INIT.ORA file

    Dear all,
    How can i set UTL_FILE parameter in the INIT.ORA file.
    Also let me know how to create a directory over there.I am new to this area.
    Where exactly i can locate these details and create directory.
    Regards,
    Bala.

    Dear all,
    How can i set UTL_FILE parameter in the INIT.ORA
    file.
    Also let me know how to create a directory over
    there.I am new to this area.
    Where exactly i can locate these details and create
    directory.
    Regards,
    Bala.Taken note of yingkuan's comments about directory objects - which don't need a utl_file_dir entry - if you really still need to know (on e-business suite or some other product that needs them) then UTL_FILE_DIR is an initialisation parameter which takes a comma separated list of directories on the database server and to which the oracle software owner (usually oracle on *nix systems and system on windows) has read/write access. To set it therefore you'll need to identify or create your directory and then either
    a) add the line UTL_FILE_DIR=/path/to/dir1, /path/to/dir2
    to your init.ora if you are using one or use
    b) ALTER SYSTEM SET UTL_FILE_DIR=/path/to/dir1, /path/to/dir2 SCOPE=SPFILE;
    if you are using a server parameter file.
    You should be able to find this and more information in the documentation for your version of Oracle.
    Niall Litchfield
    http://www.orawin.info/

  • How to Dynamically read Collections?

    Hi,
    I want to read collections dynamically. I have a requirement where I need to take any COMPLEX collection and goto the leaf node and get the results. I'm able to get the attributes using "ALL_TYPES" and "ALL_TYPE_ATTRS" etc but how can I read dynamically?
    for example I've a following simple type declared but is giving error. I hope any proposed solution will work with collection "TYPE T IS TABLE OF R" as well.
    DECLARE
    TYPE R IS RECORD (X VARCHAR2(1), Y VARCHAR2(1));
    VAR R;
    TST VARCHAR2(100);
    BEGIN
    VAR.X := 'I';
    VAR.Y := 'J';
    EXECUTE IMMEDIATE 'SELECT VAR.X FROM DUAL' INTO TST;
    DBMS_OUTPUT.PUT_LINE(TST);
    END;
    Thanks

    So, let suppose I want to read Test6.Test5(1).Test4.Five Dynamically? How can i do that if objects are populated? Here's one way:
    SQL> create type test1 as object (one date);
    Type created.
    SQL> create type test2 as object (two number, three varchar2(10), four test1);
    Type created.
    SQL> create type test3 as table of test2;
    Type created.
    SQL> create type test4 as object (five varchar2(1), six date, seven test3);
    Type created.
    SQL> create type test5 as table of test4;
    Type created.
    SQL> create type test6 as object (eight test5);
    Type created.
    SQL> var cur refcursor
    SQL> declare
      procedure testobj (myobj test6)
      is
        myval   varchar2 (10);
      begin
        open :cur for select x.column_value.getrootelement() || ': ' || x.column_value.extract('*/text()').getstringval() result from xmltable ('*' passing sys_xmlgen (myobj).extract('ROW//*')) x;
      end;
    begin
      testobj (test6 (test5(test4(1,sysdate, test3(test2(5,67,null))))));
    end;
    PL/SQL procedure successfully completed.
    SQL> print cur
    RESULT                                                                                                                           
    EIGHT:                                                                                                                           
    TEST4:                                                                                                                           
    FIVE: 1                                                                                                                          
    SIX: 22/03/2012 18:16:23                                                                                                         
    SEVEN:                                                                                                                           
    TEST2:                                                                                                                           
    TWO: 5                                                                                                                           
    THREE: 67                                                                                                                        
    8 rows selected.

  • Target Data Collection in ASCP

    Hi,
    I was NOT able to see "Target Data Collection" parameter in LOV of Data Collection Concurrent Program.I was able to "see" ONLY Complete Refresh Parameter in LOV.
    Is there any Profile Option?
    Regards
    NTGR

    set "purge previously collected data" to 'NO' in the parameter list. you will able to see "targeted collection" and "Net change Collection" in Collection Method parameter LOV.
    Regards
    Abhishek

Maybe you are looking for

  • Cannot use DFD IIR Comb Filter Design in my application

    Hi everybody, I am filtering power line noise 60 Hz and its harmonics (120Hz, 180Hz,..) using Comb Filter Design. I do the same as the example in LabVIEW, but it does not work. Anyone help me how to put that Comb filter into my application? Thank you

  • Is it possible to get the ip address of the person who logged in a site

    I need to get the IP address of the person who is browsing, i have tried request.getRemoteAddr() which is giving a firewall ip address but not his local system ip. what is the way to find out the ipaddress? should i use any applets or javascript?

  • Why does my chart build as a white box rather than a line in slideshow?

    In creating a line chart, no matter which master theme I use, whenever I select "wipe" as my build, it looks great in the build preview window, but when I view play slideshow, a white box replaces my chart. Sure, I could use other build options, but

  • Audio problems and can't open project to another computer.

    I'd like some help with moving a project from my G4 powerbook (10.4.3 1Gb RAM) to my G5 iMac (10.4.4 1.5Gb RAM) both with ilfe 06 installed. I copied the project file across and it won't start up on my iMac. The reason I'm trying to move the project

  • Blank Document Panel

    Hi, When I open an image in Photoshop CS5, the document panel remains blank.  I can see the image is visible in the panel displaying the layers, but the rest of the screen just remains blank.  I am not a savvy Photoshop user.  I mainly use it to resi