Is it possible to create findBy method for collection of ids?

subj -
I have a set of ids (HashSet of Integers).
is it possible to create such findBy method which retrieves group of entity beans with ids specified in the set?

You could do something like:
PrimKeyBean
public PrimKey ejbSelectPrimKey(Long key) throws FinderException;
public Collection getPrimKeys(Collection keyset) {
  try{
    Vector output = new Vector();
    Iterator it = keyset.iterator();
    while(it.hasNext()){
      output.add(ejbSelectPrimKey((Long)it.Next()));
    return output;
  } catch (FinderException fe) {}
...deploymentdescriptor.ejb
<query>
<query-method>
<method-name>ejbSelectPrimKey</method-name>
</query-method>
<ejb-ql>
SELECT OBJECT(o) FROM pkTable o WHERE pkTablePK = ?1
</ejb-ql>
</query>
...client
Collection c = primKey.getPrimKeys(keyset);
...

Similar Messages

  • FindBy method for reference entities

    hi,
    I have created an entitity(Relation) which contains references of other 2 entities(address, person).I have created findBy methods(FindByCity,FindByLastName,etc) in Relation entity for attributes in those refernce entities(Address-city,state)(Person-First name, Last Name). but while i'am testing these functions it says :
    <b>ERROR. setFilter column(25): Undefined expression 'personRef_var.refObject.name'</b>
    I'am not able to decipher this error message. can anyone help me about what could possibly be wrong in the code generated. the following is the code containing this reference :-
    if ("addressRef".equals(attrName))
    if (subAttrName == null)
       resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.AddressRefVO");
                             resQueryFilter.setCollectionAttribute("addressRef");
                             resQueryFilter.setAttribute("addressRef_var.refObject.key");
    else
         strParamName = subAttrName;
         dotIndex = strParamName.indexOf('.');
         attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
         subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
         resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
                             resQueryFilter.setAttribute("addressRef_var.refObject." + strParamName);
    } else if ("personRef".equals(attrName))
    if (subAttrName == null)
    {                         resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.PersonRefVO");
                             resQueryFilter.setCollectionAttribute("personRef");
                             resQueryFilter.setAttribute("personRef_var.refObject.key");
    else
         strParamName = subAttrName;
         dotIndex = strParamName.indexOf('.');
         attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
         subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
         resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
         resQueryFilter.setAttribute("personRef_var.refObject." + strParamName);

    Hi Pamita,
    Generation is errorneous for related entities which do not have relations at all. This problem emerges when you searching by some specific attribute of related entity.
    The following workarounds:
    1. Create a fake relation for Person and Address entities. For example you can create relation from Person to Person.
    2. Change generation template. I don't remember template name - it should be like ServiceBean.
    the following fix in generated coding should work:
    <code>
    if ("addressRef".equals(attrName))
    if (subAttrName == null)
    resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.AddressRefVO");
    resQueryFilter.setCollectionAttribute("addressRef");
    resQueryFilter.setAttribute("addressRef_var.refObject.key");
    else
    strParamName = subAttrName;
    dotIndex = strParamName.indexOf('.');
    attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
    subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
    resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
    resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.AddressRefVO");
    resQueryFilter.setCollectionAttribute("addressRef");
    resQueryFilter.setAttribute("addressRef_var.refObject." + strParamName);
    } else if ("personRef".equals(attrName))
    if (subAttrName == null)
    { resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.PersonRefVO");
    resQueryFilter.setCollectionAttribute("personRef");
    resQueryFilter.setAttribute("personRef_var.refObject.key");
    else
    strParamName = subAttrName;
    dotIndex = strParamName.indexOf('.');
    attrName = (dotIndex == -1) ? strParamName : strParamName.substring(0, dotIndex);
    subAttrName = (dotIndex == -1) ? null : strParamName.substring(dotIndex + 1, strParamName.length());
    resQueryFilter = new com.sap.caf.rt.bol.util.IntQueryFilter((com.sap.caf.rt.bol.util.QueryFilter) qf);
    { resQueryFilter.setCollectionType("com.sap.relation.besrv.relateaddperson.PersonRefVO");
    resQueryFilter.setCollectionAttribute("personRef");
    resQueryFilter.setAttribute("personRef_var.refObject." + strParamName);
    </code>
    Be carefull while changing template because this generated piece of coding is used in many places.
    Best regrads,
    Aliaksei

  • Is it possible to create a program for embedded system

    Is it possible to create a program for embedded system?

    Yes. Many solutions.
    1 = http://jcx.systronix.com/
    2 = http://www.harbaum.org/till/nanovm/index.shtml (see links to Asuro)
    And many more but I'm too lazy too look them for you ...
    Dan

  • Is it possible to create Intrastat declaration for service only posted inFI

    Hi
    Is it possible to create Intrastat reporting for services that is only posted in FI(without PO) for Italy. If you have any idea please let me know .
    Thanks
    Rao

    Is it possible to create Intrastat reporting for services that is only posted in FI(without PO) for Italy. If you have any idea please let me know .
    Thanks
    Rao

  • LSMW :Is it possible to create F4 Help for File path selection

    Hi All .,
    Please let me know is it possible to create F4 help for file path creation in LSMW .
    thanks
    Sreenivas

    Hi,
    I don't get it.
    In the step " Specify files" you will have the option to pick your flat file which is on the desktop by pressing F4 .
    What is that you exactly want??
    Warm regards,
    Hari Kiran

  • Is it possible to creat Shoppping cart for Blocked vendor in R/3

    Hello all,
    is it possible to create shopping cart for blocked vendor in R/3. we are using extended classic scenario with SRM 5.0. when i am trying to do this vendor is not visible in vendor list. Am i missing somthing???
    if it is not possible in standard set up...what exactly i need to do.
    my requirement is that i should create shopping cart and then PO for posting block vendor in R/3 ( i know that we can do it in R/3)
    how to achieve this in SRM 5.0 please guide.
    Thanks
    Rupesh Mundhada

    There are possibly three types of blocks for a vendor in R3
    1. All company code are blocked for vendor
    2. Selected company code is blocked for vendor
    3. Vendor if blocked for the purchasing organization
    But SRM allows only Central Locking and Purchasing Organizations level locking to be replicated from R3 - MM. So If the vendor is only blocked for a selected company code it will be still possible to create the shopping cart successfully, followed by purchase order; and PO will be issued to Vendor also; but it will not be replicated until and unless the block at the selected company code level is removed.
    This is not wrong; though you will be able to change them as per your business need. The reason is Selected Company Code level block is only used by finance people to stop payment to vendors because of some reasons like exceeding the limit or anything else.
    Please reward points if you find it useful.

  • Is it possible to create a BOM  for ROH material for Subcontracting

    Dear Guru's
    As per my knowledge BOM is needed only for HALB & FERT material even if for subcontracting purpose. So is it possible to create a BOM for ROH material for Subcontracting?. Pls help me to get a soln ?
    Regards
    Ragesh

    Ragesh,
    When you are subcontracting the material, the Std SAP says that the material type should be HALB and not ROH.
    But if client requires for any reason that the material should be ROH only, there is no problem in chaning the settings.
    Sumeet

  • Is it possible to create  inspection plan for "Inprocess Inspection"

    Hi,
    Is it possible to create  inspection plans for "Inprocess Inspection".
    If yes , what would be the "task List Usage".Is it "1"?
    If no ,then how to map this requirment?
    Regards
    Vemula

    Hi
    Vemula
    Generally as Per SAP std Routing is used for inspection of 03 type of inspection.
    but you can also customize the Inspection task list Usage for Inprocess Inspection.
    This is possible through
    QCC0>Quality Inspection>Insp lot creation>Assign Insp type to origine>
    here informt of 03 inspection type you can assign
    Task list type:Q
    Usage:either 1(Production) or 3(Universal)
    save
    Regards
    Poonam

  • Is it possible to create different invoices for a single contract?

    Hi All,
    is it possible to create different invoices for a single contract?
    My customer is asking an invoice per service line.
    Thank you for getting back to me on this.
    Kind regards
    KK

    Can somebody please advice?

  • How to create a method for reading a file

    i tried to make it as static method for reading a file and
    then to return string
    is this code correct?
              public static String fileMaterial(String fileName)
                   fileReader = new BufferedReader(new FileReader(fileName));
                   info = fileReader.readLine();
                   while(school != null)     {                    
                        return info;
                        info = fileReader.readLine();

    I created a class you might want to look at. I come from a world of C and love fgets() and other FILE stream functions. I created a class that uses the Java I/O buts to the calling application behaves like fgets and such. The block of code where I do the calling in the calling program even looks like C. In my class I capture almost all errors and set error buffers to the errors. The calling program looks at the return to see if it succedded or errored.
    BuffIO new = BuffIO.fopen("fiilename", "r");
    String s;
    if((s = new.fgets()) == null)
    System.err.println("error reading file: " + new.ferror());
    That would be waht the calling program does

  • Its possible to Create Bussiness Service for IDOC Communication Channel

    HI FRNDS,
    My scenario File to Idoc,
      When we will go for business Service , Its possible to create Business Service SAP R/3, its a Good advice.
    To which Adapters we will use business Service, business System
    Regards,
    raj

    Hi,
    This is the basic difference between Business Service and Business System. This will help you in concluding why you use them and hence you can deduce your answer....
    Business System
    Business systems are logical systems that function as senders or receivers within the SAP Exchange Infrastructure. You configure business systems in the SAP System Landscape Directory (SLD). A business system is always associated with a technical system (here: SAP Web AS ABAP system).
    Business Service
    Using a business service, you can define the technical or business subunits of the companies involved and then assign them the relevant interfaces.
    You usually use business services when configuring cross-company processes. In this case, you only make your interfaces known to the business partners involved and either do not make any details about your own system landscape available, or only specific details.
    Regards
    Arpil
    Reward points for the useful answer

  • Is it possible to create new shortcuts for pages esp footnote

    Hi
    Is it possible to create shortcuts in Pages? Hidden preferences?
    I'd like to have something for inserting footnotes.
    Via thirdparty apps?
    Thanks for hints
    Regards
    Martin
    G4 Quicksilver 800, powerbook 15'', 1,33   Mac OS X (10.4.8)   1,25 RAM and 768 RAM

    Martin, it's possible to create shortcuts for any menu item in any OS X application. You do this by going to the System Preferences, in the Keyboard and Mouse pane, under the Keyboard Shortcuts tab. See this posting for more details.
    This is an extremely powerful feature of OS X, and it is unfortunate that is it not better known.

  • If it possible to create a Reportvariant for my Screen???

    Hi at all,
    i want to create a Reportvariant for my Screen '0200'.
    If i klick on the Button "SAVE", than it must opening a Reportvariant Window.
    (A report can have several different variants, with each variant retrieving different types of information.)
    There is one Problem, my Screen "0200" is created with Screen Painter, is it possible to add there a Reportvariant????
    I think there must be existing some Functions to open and save a Reportvariant.
    I hope anyone can help me.

    HI
    try this FM RS_VARIANT_SAVE_FROM_SELSCREEN...
    best regards
    Marco

  • Is it possible to create outbound delivery for sales order with FM: GN_DEL*

    Hi all,
    Is it possible to create an outbound delivery for a sales order using the FM: GN_DELIVERY_CREATE. I am choosing this over a BAPI as I also needed to fill the bill of lading and inco terms.
    Thanks

    Hi Gurus, is there any function module / Bapi that updates the BOL in a outbound delivery  header created for a sales order

  • Is it possible to create an alias for a network share?

    I would like to have an alias on my desktop for several network shares. If I create one and then eject the share, the shortcut still works for a while, but then it fails to find the target.
    I would like to avoid having to use the Go to server function every time I want to connect to a share.
    Regards,
    -Travis

    Hi Rene,
    It is not possible to create alias of sap pi webservice. refer the micheal's reply in below blog
    Alias for Sender SOAP Adapter URL
    regards,
    Harish

Maybe you are looking for

  • Average Values in query

    Hi In my query I am unable to average the values in the query is there a way of getting number of records in the query please tell me how to get average values in the query level i went to properties i found the average option but that does not work.

  • FM derivation rule - ??? client copy

    Hi Expert, I have encountered a strange problem on FM derviation rule (TCODE FMDERIVE). I tried to client copy a "gold copy" client to a seperate client using using SAP_ALL but found that all the details derviation rule were missing.... I tried in my

  • JTextArea:  How do I force a JTextArea to refresh?

    Hi All, I have a JTextArea that I append data do when I'm in a while loop. The JTextArea displays the text after the loop has finished, not as data is appended to it during the while loop. How can I force the JTextArea to refresh immediately after te

  • Hr: Pay-Slip Layout Change

    Hi Guys, This is Prabhu from Pepsi, india. I am new to SAP-HR(ABAP).I have a requirement to chanhe the layout Format of pay-Slip. That is : In place of Company Code, i have to Display Emp PAN Number. In Tcode: PE51 , i am trying to change that fields

  • HT5661 Back up

    Hi All Need some help as I'm so rubbish at technology!! I have the OLD I phone 3 and tomorrow I'm getting my I phone 5, anyone know how to back up on I tunes? I know I'll have a new dimension, but I just wanted to transfered everything from my old ph