Problem finding row using findbykey()

Could someone give me any hints as to why when I call viewObject.findByKey(keyx, -1) it returns null yet viewObject.getRow(keyx) returns the correct row?
Cheers
Shaun Field

Hi Steven
I use the following code to construct my key for the View/Entity object that has the primary key values AppName, Release, and Status:
FTReleaseNoDomain releaseNo = new FTReleaseNoDomain( request.getSession().getAttribute("ReleaseNo").toString());
NameValuePairs attributeList = new NameValuePairs();
attributeList.setAttribute("AppName", request.getSession().getAttribute("ReleaseAppName"));
attributeList.setAttribute("Release", releaseNo);
attributeList.setAttribute("Status", request.getSession().getAttribute("ReleaseStatus"));
Key key = vo.createKey(attributeList);
I then try calling the following:
Row row = viewObject.getRow(key);
Row rowArray[] = viewObject.findByKey(key, -1);
The variable row has some value where as rowArray[0] causes an ArrayOutOfBounds exception(ie it's empty).
I have tried changing the variable releaseNo to a string but that doesn't give me a correct key thus causing the getRow() to fail.
I have found that I'm able to get a result for findbyKey() if I use the key that I get from the row found using getRow(). eg Key rowKey = viewObject.getRow(key).getKey();
The version of Jdeveloper/BC4J I'm using is 9.0.3.3
Cheers
Shaun Field

Similar Messages

  • Problem deleting rows using JDBC

    Hi,
    I have a problem with the following code listed below. I am attempting to delete a user's details from a SQLServer db based on the user selected from a combobox. The code given below is just a section and relates to a JButton I have on the application that performs the delete command.
    public void deleteButton_actionPerformed(ActionEvent e) {
    try{
    String opName = (String)userNameBox.getSelectedItem();
    String deleteQuery = "select * from Operator where OperatorName = " + "'"+opName+"'";
    //Load Database Driver Class
    Class.forName(JDBC_DRIVER);
    //Establish a connection to the Database
    connection = DriverManager.getConnection(DATABASE_URL);
    //Create Select statement for returning all usernames to the combobox
    statement2 = connection.createStatement(java.sql.ResultSet.TYPE_SCROLL_SENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);
    //dQuery.setString(1,opName);
    resultSet = statement2.executeQuery(deleteQuery);
    while (resultSet.next()){
    resultSet.deleteRow();
    catch(Exception exception){
    exception.printStackTrace();}
    To explain the code, to begin with a String holds the value of the selected field of the combobox i have in my app. I have the SQL select statement the using this variable as the where clause.
    The usual connection and statement objects are declared etc and then the query is executed. Within the While loop I then attempt to delete the row that the query has retrieved for me. However this results in the following error.
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid attribute/option identifier
    Any help is much appreciated.
    Thanks
    Alan

    Thanks for the reply. I understand your comment about
    using the delete statement and it seems I am making
    an obvious error. However I was using the select
    statement to generate a resultSet object with which I
    can delete elements from. Hence the reason for the
    use of the select statement.This is brain dead, the classic newbie mistake. The database vendor has optimized their code more than you ever will in making those deletes, so use their code. Not only will they do it faster than you will, but you'll save yourself (n+1) network roundtrips (1 for the SELECT, 1 for each DELETE you issue). Better to learn SQL and use a WHERE clause to do it on the database side.
    You have however solved the problem I had with
    directly executing the delete statement as an SQL
    String. I was using the following statement:
    String deleteQuery = "select * from Operator where
    OperatorName = " + "'"+opName+"'";
    The wildcard character is not required and it was
    this that gave me problems and made me look to using
    a select query and deleting results from a
    resultSet.Sounds like you need a SQL book. I recommend "SQL For Smarties".
    %

  • Problem finding docs using content index in DB with different charactersets

    Sorry for duplicating thread from [url http://forums.oracle.com/forums/thread.jspa?threadID=653067&tstart=0]this thread in Oracle Text forum, but it seems quite slow compared to this one, so probably someone has some suggestion.
    Problem explanation:
    DB version 10.2.0.1 SE on windows
    database characterset AL32UTF8
    I am creating following context index:
    create index myindex on g(Content)
    indextype is ctxsys.context
      parameters('filter ctxsys.auto_filter
      section group ctxsys.null_SECTION_GROUP');With following query:
    SELECT distinct filename FROM g f
    WHERE contains(F.Content, 'latiinju') >0;I can find latin symbols in ansi, utf-8 encoded text documents and msword and msexcel documents.
    With following query:
    SELECT distinct filename FROM g f
    WHERE contains(F.Content, 'latviešu') >0;I can find latvian symbols in utf-8 encoded text documents and msword and msexcel documents, which basically is OK.
    However there is another unfortunately already production database
    10.2.0.3.0 SE on windows
    with characterset BLT8CP921
    and with index as defined above queries find absolutely nothing for both latin and latvian texts.
    As soon as I've added another column "cset" in the table and filled it up with AL32UTF8 I can find latin characters for the same cases as in db above.
    Index in this case is as follows:
    create index myindex on g(Content)
    indextype is ctxsys.context
      parameters('filter ctxsys.auto_filter
      section group ctxsys.null_SECTION_GROUP
      charset column cset');However the problem is that for latvian characters it can find only UTF-8 encoded text files, but not doc and xls files and that's absolutely not OK.
    I've tried also another charactersets in cset columns, but without any success.
    So the question is - is there any possibility somehow to create the content index that it is possible to find also latvian specific symbols in doc and xls files in DB with characterset BLT8CP921?
    Of course the ultimate solution would be to recreate db with AL32UTF8 characterset but I'd like to avoid that if possible.
    TIA
    Gints Plivna

    I have applied performance tuning steps, like JAVA_POOL_SIZE, SGA_MAX_SIZE, increase table spaces size and change some other DB parameters. After applied, problematic index has been created without error and application is running fine without any error. Many thanks for your prompt suggestion, by which I could narrow down my problem. So, as my problem has been resolved, so please close this thread.
    Regards,
    Farhan Mazhar

  • Problems finding music using search using version 9

    When I use the 'search' feature (the upper right hand field on the screen) in version 9, I was unable to find the music I was looking for. For example, I wanted songs by Brian Ferry. I search his name and the results shows me lots of things, including Roxy Music. I look in the list for the song "Don't Stop the Dance," just as an example, but it's not there. Since I want just Brian Ferry's music, I click on Brian Ferry in the left-hand list of artists. It shows me only one of his albums but not the rest. Then, I start the search over again, this time searching for "Don't Stop the Dance." Now it shows me the song in the results list with Brian Ferry as the artist. When I click on the song, it takes me to the correct album. My question is: why didn't the song come up when I searched by artist? If I can't recall the name of the song I want, I'd be out of luck tryign to find it by the artist.

    Perhaps it is listed under Bryan rather than Brian. That would be the correct spelling of his name.

  • Finding minimum value in each row using dynamic query

    need to find the minimum and maximum value from each row using dynamic query
    [from curr] will be given as input
    Tuky

    DECLARE @t TABLE(a INT,b INT,c INT);
    INSERT @t VALUES(1,2,3),(9,8,7),(4,6,5);
    SELECT *
    ,      (   SELECT  MAX(val) 
               FROM    (VALUES (a)
                           ,   (b)
                           ,   (c)
                       ) AS value(val)
           ) AS MaxVal 
    ,      (   SELECT  MIN(val) 
               FROM    (VALUES (a)
                           ,   (b)
                           ,   (c)
                       ) AS value(val)
           ) AS MinVal 
    FROM @t;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Find row in Dataview using ID but Name sorted in alphabetical order

    Hi,
    I have a dataview with 2 columns, ID and Name, where it is sorted by"Name".
    I want to find a row using the ID, namely curID. But the following doesn't seem to work, as I believe my dataview was sorted using the Name column. How can I sort the dataview with "Name", but be still be able to "Find" using its ID?
    dv.Sort = "ID ASC"
    rowIndex = dv.Find(curID)
    Please advice. Your help would be greatly appreciated.

    Use a plain old for loop then. You could define your own method:
    private static DataRowView FindRow(DataView dv, int id)
    foreach (DataRowView rowView in dv)
    if (Convert.ToInt32(rowView["ID"]) == id)
    return rowView;
    return null;
    And call it like this:
    DataRowView dataRowView = FindRow(dv, curID);
    if(dataRowView != null)
    //found...
    Please remember to mark all helpful posts as answer and/or helpful.

  • What is an smpt password?  I have problems sending photos using the stamp at the bottom because it asks for some smpt password and I have no clue to find out what it is, how to set one of find one if I somehow put one in and don't know what it it.

    what is an smpt password?  I have problems sending photos using the stamp at the bottom because it asks for some smpt password and I have no clue to find out what it is, how to set one of find one if I somehow put one in and don't know what it it.

    It's the password for your outgoing mail in your Mail account. You need to set it up in your Preferences.
    Regards
    TD

  • Hello everyone! Did you find any problems so far using hotspots?

    Hello everyone! Did you find any problems so far using hotspots with iPhone 4?

    Just the usual ones in dealing with some routers with buggy firmware and such.
    I'm sure there have been many who have had problems, but mine has worked beautifully at a wide variety of hotspots like those at McDonald's, Starbucks and Borders.

  • I'm getting prompted to update adobe acrobat 9.5.5 which I have deleted. I am currently using 10.1.13. It is still asking me to update 9.5.5 (can't find anything using it) I have tried to cancel the updates for 9.5.5 but it only recognizes the 10.1.13 ver

    I'm getting prompted to update adobe acrobat 9.5.5 which I have deleted. I am currently using 10.1.13. It is still asking me to update 9.5.5 (can't find anything using it) I have tried to cancel the update prompts for 9.5.5, but it only recognizes the 10.1.13 version. Suggestions? Am I missing something? It's driving me crazy!

    Hi ncm72,
    Could you please let me know what version of OS are you using.
    Also, go to Control Panel/System Preferences in Windows/MAC and check whether Acrobat 9 is shown under installed programs list.
    You might also try running Acrobat cleaner tool to remove all traces of previous versions of Acrobat:
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Then, install Acrobat X again from the link mentioned below:
    Download Acrobat products | Standard, Pro | XI, X
    Let me know if this works.
    Regards,
    Anubha

  • Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES

    sorry, wrong board - i opened a new post
    Problem with BAPI_CUSTOMER_CREATEFROMDATA1 using JCo on IDES
    Hello everyone,
    we are working on a student project and would like to create customers (debtors) in an SAP IDES system.
    Using the ref-customer to copy from, and some personal-data below, we get the error message
    'Internal error: External no.assignment for reference customer/customer'
    We also tried with BAPI_CUSTOMER_GETINTNUMBER, and ACCOUNTGROUP ZINT (New Internet Customer, others won't work?). But CREATEFROMDATA1 takes no CustomerNo created this way, nor it wants to create one 'internal'?
    Any suggestions? Thanks a lot for your help,
    Greetings,
    Tobias Schmidbauer
              inParams = function.getImportParameterList().getStructure(
                   "PI_COPYREFERENCE");
              inParams.setValue("0000001000", "REF_CUSTMR");
              inParams.setValue("1000", "SALESORG");
              inParams.setValue("10", "DISTR_CHAN");
              inParams.setValue("00", "DIVISION");
              inParams =function.getImportParameterList().getStructure(
                   "PI_PERSONALDATA");
              inParams.setValue("Simpson", "LASTNAME");
              inParams.setValue("Homer", "FIRSTNAME");
              inParams.setValue("Jay","MIDDLENAME");
              inParams.setValue("Springfield", "CITY");
              inParams.setValue("DE", "LANGU_P");
              inParams.setValue("DE", "LANGUP_ISO");
              inParams.setValue("DE", "COUNTRY");
              inParams.setValue("EUR", "CURRENCY");
              inParams.setValue("12345", "POSTL_COD1");
    Message was edited by: Tobias Schmidbauer

    Hello Brian,
    Thanks for your pointer. Actually The customer's reference number i was providing in the PI_COPYREFERENCE structure was a sold-to party customer and it uses external customer number assignment. When i used "New Internet Customer" (that doesnt use external assignment by default) as customer's account group, the customer was created successfully and assigned customer number was returned.
    I want to ask now how could we give a customer number in the BAPI as i am unable to find any such column in any of the tables. (Customer number is an "out" parameter so it can only return the number of created customer). Secondly, how to chnage the external assignment property of a particular account group (like sold-to party). i.e, how could we change the account group configurations through SAP GUI??
    - Umair

  • Find row in 2d array

    please help...
    i have 2d array of double and i wanna find specific row an extract to new 2d array.
    My 2d array is:
    100
    31,3
    25,3
    32,1
    25,6
    100
    31,3
    25,3
    32,1
    25,6
    160
    32,4
    25,5
    33,5
    26
    170
    33,2
    25,8
    34,3
    26,2
    100
    33,9
    26
    35,2
    26,4
    160
    32,4
    25,5
    33,5
    26
    160
    32,4
    25,5
    33,5
    26
    100
    31,3
    25,3
    32,1
    25,6
    170
    33,2
    25,8
    34,3
    26,2
    and i wanna find row with numbers 100,160,170 and build new 2d array
    100
    31,3
    25,3
    32,1
    25,6
    160
    32,4
    25,5
    33,5
    26
    170
    33,2
    25,8
    34,3
    26,2
    please help....tnx, tnx
    Solved!
    Go to Solution.

    I guess you should be more specific about your question. If you are planning to find the values that are present in the 1st column then you can use search 1D array and pass the index to index the 2D array so you will get 1D array of row then build the array by finding the element.
    This is what Yamaeda explained
    The best solution is the one you find it by yourself

  • Problem finding my sound effects and music in final cut pro X

    I am having a problem finding my sound effects and music in final cut pro X.  I just bought a new i
    Mac, because my Mac pro died.  when I was using the mac pro, I had final cut Pro X loaded, and in the Music and sound library, I had stock tracks from APM music that came with final cut.  now that I have loaded final cut to my new computer, I do not see those tracks.  Am I missing something?

    The FCP X sound effects were an additional external download and were not kept in the FCP X application.
    You probably need to re-download them.
    In the FCP menu at the top left of your screen you will see the download link.

  • How to find row changes in table

    How can we find row changes in table and i want o find out any significant change in the row information in 11g db.

    hi thanks for ur help
    but i had one more problem
    already i tried this one
    at particular time i am getting that record
    ........................ col1 col2 col3 col4 col5
    3/17/2012 11:55 AM 10 20 30 40 50
    3/17/2012 12:00 PM 0 0 0 0 0
    3/17/2012 12:05 PM 12 22 32 42 52
    see here at 12:00 PM i got the null or zero values.so instead of null values i need consecutive record means below row like 12:05 row values i need
    output is:
    .......................... col1 col2 col3 col4 col5
    3/17/2012 11:55 AM 10 20 30 40 50
    3/17/2012 12:00 PM 12 22 32 42 52
    3/17/2012 12:05 PM 12 22 32 42 52
    its very urgent plz help to me.
    Edited by: 913672 on Mar 17, 2012 6:35 AM
    Edited by: 913672 on Mar 17, 2012 6:36 AM
    Edited by: 913672 on Mar 17, 2012 6:36 AM

  • Toystore: Using findByKey instead of other query methods

    I think I already know the answer to this but I cannot exactly find supporting documentation. I would like to know when it is appropriate to use findByKey over setting the where clause parameters and calling executeQuery. I notice the Toystore sample does this wherever possible. When do I know I should use it in my application and why? As a standard practice, I have been using the where clause method. Are there any pitfalls to using findByKey?

    Thanks for the response. I tried List Item, but it isn't what i sought as it is a display-only field. I could say Update allowed false, but still people ask question why the list is provided when we cant change it.
    I found an interesting solution to it.
    On the database field (say change_allowed) if 'Y' denotes "Yes" and 'N' denotes "No" then use Property Palette and change the Column Name (under Database Group) to decode(change_allowed,'Y','Yes','N','No') change_allowed and increase the size of the column to 5 instead of 1. Works amazingly well :)

  • Having problems finding and importing actions I recorded in CS5 :(

    Hi. I've recently upgraded from CS5 to CC but I'm now having problems finding and importing actions that I previously had recorded in CS5. Where do I need to look to locate these actions, as they are still in CS5 when I open it.

    You export them using the flyout menu in the top right corner of the actions palette. Conversely, you load them the same way in the new version.
    Mylenium

Maybe you are looking for

  • Pavilion dv6 will not boot up.

    When I start my Pavilion dv6, the fan starts, the on key light on, light on f12 key and on caps lock key. Screen remains blank. Have tried taking out battery, and unplugging. Wait and power again. Same thing keeps happening. HELP please.

  • Configuration issue related OBIEE 11G coreapplication_obips1

    Hi All, My issue is related to configuration of OBIEE 11g, My installation is successful on windows server 2003, with Enterprise Install but this coreapplication_obips1 is failing to configure anybody has any idea to resolve this, Why this error is c

  • Between Query in Oracle

    Hi, Is it possible to fetch the value between the same date. When i use the below query with different date its working fine. but when i use the same query with same date it is not working. select m.doc_id,m.date from log m,content c where c.id= m.id

  • Ovi Contacts and Offline Friends

    Ok so I've just installed and set up Ovi Contacts and I've just added my friend who uses Google Talk, now I can chat to him fine but it always says he is offline, when I sign into Google Talk on my PC it says he is onlien so he hasn't set him self to

  • Is it too much database load?

    Hi. Does anybody have numbers about how much database activity (e.g. per hour) should be expected per live instance? I know there are so many conditions related to configuration and the process itself, automatic activities, global activities, dispose