Update the existing line in Java

Hello

I'm working on a page of user information in which a manager can view the details of a selected user (name, password, id, etc.) My original installation of the page was just a form view object that the Manager could replace any piece of information, and then click a button of validation to make changes to the table in the database. I need to implement an encoder of password, however. I also have a page that uses a method of the App Module which can encode passwords:

...
EntityDefImpl AppUsersDef =
ApplicationUsersImpl.getDefinitionObject ();
ApplicationUsersImpl = newAppUsers
(ApplicationUsersImpl) AppUsersDef.createInstance2 (getDBTransaction (),
(null);

DBLoginModuleSHA1Encoder encoder = new DBLoginModuleSHA1Encoder();
String hash = encoder.getKeyDigestString (passwd, "");

newAppUsers.setUsername (username);
newAppUsers.setPasswd (hash);
...

This works very well for the insertion of a new user, is it possible that I can do something similar, either on the back of the page or a new App Module method that will get the line user, I check and update the information rather than creating a new line? Thanks in advance.

Edit: I also tried to do a. createRow() instead of. getCurrentRow() and it successfully the inserted row in the database, so I know I have to get the correct VO.

Published by: \Brian/ on September 19, 2008 12:03

Hi Brian

Try these codes:

FacesContext fc = FacesContext.getCurrentInstance ();
ValueBinding vb = fc.getApplication ().createValueBinding("#{data}");
BindingContext bc = (BindingContext) vb.getValue (CF);
DC DCDataControl = bc.findDataControl("AppModuleDataControl");
ApplicationModule am = (ApplicationModule) dc.getDataProvider ();
Service AppModuleImpl = (AppModuleImpl) am;.

See ViewObject = service.findViewObject("EditApplicationUsersView1");

While (view.hasNext ()) {}
View.Next ();
view.getCurrentRow () .setAttribute (user UserValue);
view.getCurrentRow () .setAttribute (passwd, PassValue);
}

Good luck

Tags: Java

Similar Questions

  • MERGE records do not update the existing line

    Hi all

    I need your help guys, I am facing a problem with the discovery of the program example here merge statement.

    I have table TEST1 with C1 and C2 are the columns C1, we have a primary key.

    create table test1 (number (5) c1, c2 number (5));

    ALTER table test1 add a primary key (c1);

    MERGE INTO test2 target

    USING (SELECT 1 c1, c2 2)

    OF the double

    UNION ALL

    SELECT 2, 2

    OF the double

    UNION ALL

    SELECT 2, 2

    OF the double

    UNION ALL

    SELECT 2, 1

    SOURCE FROM dual)

    WE (target.c1 = source.c1)

    WHEN MATCHED THEN

    Updated the VALUE of c2 = source.c2

    WHEN NOT MATCHED THEN

    INSERT (c1, c2) VALUES (source.c1, source.c2);

    When we execute the merge statement I am faced with unique constraint violation.

    Can any one help for solve the problem?

    Thank you all...

    http://docs.Oracle.com/CD/E11882_01/server.112/e41084/statements_9016.htm#SQLRF01606 States

    MERGEis a deterministic statement. You cannot update the same row in the target table multiple times in the same MERGE statement.

    Concerning

    Etbin

  • Display warning message if the user tries to update the existing column of trans_dt

    Form of Oracle 10g

    Hi gurus

    I appreciate if someone help out me. I need to display the warning message if the user try to update the existing trans_dt, and I don't know what trigger I use. Thank you

    Concerning

    Matt

    Hello

    You can select the value entered by the user and then compare it with the data from the db table

    in WHEN-VALIDATE-ITEM trigger

    SELECT trans_dt

    V_ INTOtrans_dt

    table

    WHERE THE... -PKs;

    Then

    IF: trans_dt <> v_trans_dt

    THEN

    -warning-

    -u he could leave it as what or

    raise form_trigger_failure;

    END IF;

    Amatu Allah.

  • How can I update the random lines?

    Hi all

    Table of responses I got, there are two columns that belong to this table. This table contains 1 million rows. The response column can be numeric or text.
    create table answers(
    answer_id number primary key,
    answer varchar2(50)
    );
    My question is

    I want to update the random lines 50 to 100 which is equal to "0" (zero).

    The code below works, but I just wonder does it work properly? I mean, I want to choose these lines at random. However, it is very difficult to update randomly. Is this the best way? Do you have any suggestions?
    update answers set answer = '100' where answer_id in( 
    with
    get_ids as (select answer_id from answers where answer = '0' and rownum <= 50 order by dbms_random.value)
    select answer_id from get_ids);
    In addition, when I read the relevant discussions to the update at random, someone recommends you to use the rowid, do you think I should use rowid instead of answer_id? (answer_id is also a unique value in my table) If I use rowid will be faster?

    Thanks for your help.

    Hello

    970992 wrote:
    Hi all

    Table of responses I got, there are two columns that belong to this table. This table contains 1 million rows. The response column can be numeric or text.

    create table answers(
    answer_id number primary key,
    answer varchar2(50)
    );
    

    My question is

    I want to update the random lines 50 to 100 which is equal to "0" (zero).

    The code below works, but I just wonder does it work properly? I mean, I want to choose these lines at random. However, it is very difficult to update randomly. Is this the best way?

    Almost. You want to take the 50 lines after the ORDER BY has been applied, like this:

    update  answers
    set      answer = '100'
    where     answer_id in
    (
    with
    get_ids as (
                select    answer_id
                from      answers
                where         answer = '0'
    --            and      rownum <= 50          -- DON'T use ROWNUM here
                order by  dbms_random.value
            )
            select  answer_id
            from    get_ids
            where   rownum <= 50          -- Use ROWNUM here
    );
    

    Do you have any suggestions?

    update answers set answer = '100' where answer_id in(
    with
    get_ids as (select answer_id from answers where answer = '0' and rownum <= 50 order by dbms_random.value)
    select answer_id from get_ids);
    

    The ORDER BY clause is the last part of a query to be run, after the WHERE clause is complete. As originally posted, you were pick up 50 lines with a response = '0' and then sort them in a random order. You want to select all the lines that have answer = '0', then sort them in a random order and, finally, to choose the 50 frist in the list.

    In addition, when I read the relevant discussions to the update at random, someone recommends you to use the rowid, do you think I should use rowid instead of answer_id? (answer_id is also a unique value in my table) If I use rowid will be faster?

    Yes, using ROWID will be faster.

  • How can I update the last line in a file.

    Hello

    I need to add text that should be on the 2nd last line of a text file. I get the last line using RandomAccessFile and surroundings,
            fileHandler.seek(fileHandler.length()-1-lastLine.length()-1);
            
            fileHandler.writeUTF("last_line\r"+lastLine.replaceFirst("0x00", "0x80"));
    updated the code above, I'm trying to add the text to the last line. But instead of add, the above code simply replaces the last line.
    How to solve this problem?

    BR
    Umer

    Just by adding a single line to rewrite the entire file may not be a good idea eapscially when the file is in MBs. so that is the reason why I use RandonAccessFile,.

    You don't know that? HDs store files on several trays at the same spot on the Board, so you won't lose anything in rewriting.

    I have also an other question. In other words, how I can I know the last line is achieved using PrintWriter?

    Steps to follow:
    1. read the entire file into a string
    2. parse the string by using the String.lastIndexOf ("\n") to the last character of line break.
    3. use printwriter to write the string up to the last line (use string.substring), then give your new data, and then enter the second part

    >

    BR
    Umer

  • problem updating the contract line using OKC_CONTRACT_PVT.update_contract_line

    Hi all

    I am facing a problem trying to update the end of contract line dateusing the api OKC_CONTRACT_PVT.update_contract_line. When executing the procedure that calls the api it returns the State S without error and also update the table of base that is OKC_K_LINE_B with new end date successfully.

    The problem is that whenever I'm if commit the changes to the front end, application - contract line record gets endangered. What is happening to all instances of the element. Here are the settings I am passing through the api,

    p_chrv_rec.ID: = < id for row in the okc_k_lines_b table >;
    p_chrv_rec.end_date: = < new_end_date >;
    p_chrv_rec. VALIDATE_YN: = 'N'; -I don't want the api to validate attributes

    Please note that the api is correctly updating the record base table but not able to display in the application. I tried to compare the same record before and after the update to confirm if no value of the indicator is is changed due to the record does not appear in applications. but there is no such changes except the new date and the annualiazed_factor. Can is it you pls let me know no work around as if any option profile must be changed to achieve the same.

    Navigation to the im application to check the update new end date of contract line is:

    Oracle Install Based Agent user-> Instance element-> contracts

    Thanks in advance.

    Kind regards
    Hespel.

    Published by: user10545574 on July 8, 2010 06:56

    Hello

    Shouldn't you be using the public api (OKC_CONTRACT_PUB) rather than the private sector? By directly using the package private, you are probably bypassing some features that could cause problems like the one you are talking about.

    Kind regards.

  • How to get rid of a search not intentionally installed "tab" to update the new version of Java JRE?

    Since Oracle surprisingly quickly announced an update of Java JRE (7.11 update), Jan 14, available todag I install naturally. Despite being very careful with all unwanted program providers are trying to impose on the innocent user, I always have a f * ck * thing-same to tab search ng in my line of tabs. I don't want or need, and it occupies valuable space. The evil rats who created this stinky sh * t were very careful hide all the simple ways of removing - it is not (as far as I can see) are everywhere in my lists of Add-ons or extensions. I tried to watch: config, but I am totally inexperianced with this and do not dare to change: in fact, I can't find anything usable.

    Anyone who has a suggestion how to get rid of that junk qualified? My FF is the Swedish version, that's why I stuck with raw data in the troubleshooting information. If there is a possibility here to add a screenshot of the thing, I would have.

    The tab looks like the image below? If so, did you not as a Java Update. Have you downloaded the update of Java on the Java site or elsewhere? It was expected that some less honest people would provide false updates to Java. If it looks like the image below, follow these steps:

    1. With all browsers closed, in Control Panel > programs and features (or add / remove programs), if you see "Default tab" delete (you have no default tab 1.4.3 in the list of add-ons/prefs you have submitted with your question)
    2. Launch Firefox and check that 'Default tab' is not in the Add-ons > Extensions; If it is click on 'Remove' and then restart Firefox.
    3. You may need to set your homepage in Firefox, if a search page leading to 'Search results' or "My search results" is displayed at the start of Firefox - https://support.mozilla.org/en-US/kb/How%20to%20set%20the%20home%20page
    4. You may need to remove the 'search results' or "My search results" in your list of installed search engines in the top search bar on the right (click on the image to the left of the search bar, then choose "Manage search engines") - https://support.mozilla.org/en-US/kb/search-bar-easily-choose-your-search-engine#w_removing-a-search-engine
    5. You may need to reset your default search engine used for looking for location/URL bar by resetting the preference keyword. URL - https://support.mozilla.org/en-US/kb/search-web-address-bar#w_changing-the-internet-keyword-service
    6. You may need to reset a preference if 'Search results' or "My search results" appears as a search engine every time you open a new tab (follow steps 1 to 4 in the image below to determine which opens when you click to open a new tab; see Subject: config use above)- https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites#w_how-do-i-turn-the-new-tab-page-off
  • Update the existing Web page

    I've loaded my Web page and want to make changes. I made the changes in my local folder, then selected in the menu of the Site - synchronize. I synchronize the entire site and put the newer files on the server and it seems to go through all the steps. However, when I check the site online, some updates are successful and others are not. I'll make changes regularly on this site. What should I do? So I'm back to the present, any help is appreciated!

    Whenever you makes changes to a page simply use

    Ctrl Shift U

    Is to download the page and if you choose to download dependent files, it will also take care of anyfile that must be downloaded to make it work.

  • How can I remove the existing line if my text has no fill and no respect?

    My type already has a colorful feature and a fitted width profile. The stroke shows while my guy has no fill and no respect. How can I remove it?

    Check in the appearance palette. The race may be applied.

  • It, I update the existing registration at CC?

    I have a box of products: eLearning Suite 6, CS6 Design Standard. And I have Adobe Captivate 6.1 subscription. Can I put this subscription to new CC?

    Thanks for the reply

    CC version will be available on June 17 by the announcement Monday at Adobe MAX.

  • OE_ORDER_PUB. Process_Order errors when adding a detail if one of the existing detail rows row is updated

    Hello!

    Whenever a sales order line is updated but not yet recorded in the order form, oe_order_pub. Process_Order errors when you try to add on the same command line. It gives the error "line locked out at the treatment of" the first time you run the api then it gives the error "Record is currently underway on by another user, please try to update later" on successful runs.

    When I tried to simulate the same using two forms of sale, an update of one of the lines and do not save more while the other added a line in the same order sale then save, he managed to save the line.

    What I don't understand the API's for it's to stop me if I just add a line, and it has nothing to do if an other lines are updated by another user (and this is only possible on the order form)?

    Is there anyone who has encountered the same? This is the normal behavior of the api or I missed something? No work around?

    Thank you.

    This problem is solved.

    The solution to the problem is that the value to calculate price flag must be set to 'Freeze the price' If you do not want Process_Order to update the price of unit sales of existing lines SB. Based on my observation and technically speaking, Process_Order updates price of all the existing lines of unit sales (and probably other columns) linked to the price based on the price of the object's current price list if the indicator price calculated is 'Calculate price' (I have not tried but in "Partial award"). If other users happen to edit one of these lines of l.o. and has not saved, the update fails and this is the reason for my problem.

    Thank you.

  • Need to check delays in update of 1000 lines using the PL/SQL procedure.

    Hi all

    I'm new to PL/SQL. I need your help to build a procedure that executes the following statement and follows the time of update of 1000 rows. This is to check the performance of the database. I need to print the timestamp of start before the update and end timestamp after update. I need to do for the 1000 lines. The statement that will be used in the procedure is:

    SELECT

    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').

    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').

    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').

    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').

    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | NVL (TO_CHAR (START_TS), 'NULL').

    ', END_TS =' | NVL (TO_CHAR (END_TS), 'NULL') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').

    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').

    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').

    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | NVL (TO_CHAR (LAST_UPD), 'NULL') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').

    "', W_INSERT_DT = ' | NVL (TO_CHAR (W_INSERT_DT), 'NULL') |', W_UPDATE_DT = ' | NVL (TO_CHAR (W_UPDATE_DT), 'NULL').

    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |

    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; »  OF XXAFL_MON_FACTS_F;

    The above query creates instructions of update that must be executed 1000 times and the time required to update the 1000 lines should be followed.

    Thanks in advance!

    Code horribly wrong!

    Why this approach?

    Dynamic SQL is almost NEVER needed in PL/SQL. And if you think it's necessary and taking into account what is displayed as being problems here, you have a 99% chance of being wrong.

    This 1% where dynamic SQL is necessary, he will WITH bind variables to create shareable SQL, decrease memory requests, decrease the likelihood of a fragmented shared reel and decrease the burning CPU cycles on hard analysis.

    An example below. Your approach is the 1st. One that is slower than the correct approach to 37 (x_!) ...

    SQL> create table t ( n number );
    
    Table created.
    
    SQL>
    SQL> var ITERATIONS number;
    SQL> exec :ITERATIONS := 100000;
    
    PL/SQL procedure successfully completed.
    
    SQL>
    SQL>
    SQL> TIMING START "INSERTs using Hard Parsing"
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  execute immediate 'insert into t values ('||i||')';
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using Hard Parsing
    Elapsed: 00:02:00.33
    SQL>
    SQL> TIMING START "INSERTs using Soft Parsing"
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  execute immediate 'insert into t values ( :1 )' using i;
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using Soft Parsing
    Elapsed: 00:00:06.06
    SQL> drop table t;
    
    Table dropped.
    
    SQL> create table t( n number );
    
    Table created.
    
    SQL>
    SQL>
    SQL> TIMING START "INSERTs using a single parse and repeatable statement handle "
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  insert into t values ( i );
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using a single parse and repeatable statement handle
    Elapsed: 00:00:04.81
    SQL>
    
  • Deploy the ADF - BC on different JVM (not a cluster) and update the same row

    Hi experts,

    I have a question for the locking of ADF BC. Suppose I have a web application that you want to add using add-British Colombia. And the web service interface is enabled for ADF - BC. In this case, what happens if I try to deploy as follows

    Deploy the web application ADF with add - bc on a JAVA virtual machine and the other JVM deploy only the Add-bc with active web service. In this case how the locking of the database will work. Incase if I change the line in the ADF, faces and then try to update the same line using the web service in the another JVM. Framework will lift the ADF line locked by an other user error? Or the locking works only if both are on the same virtual machine JAVA or deployment in the cluster?

    Thank you

    It depends on how you define your lock mode to work in British Colombia of ADF - but assuming you are using optimistic locking - it will be work well since the ADF BC lock will check whether the data in the DB has changed and then throws an exception in letting you know on the subject.
    http://docs.Oracle.com/CD/E24382_01/Web.1112/e16182/bcstatemgmt.htm#BABHBIAB

  • How to upgrade the existing rows in the table

    Hello..
    I use Jdeveloper 11.1.1.5.0 is my usecase
    = > I created a table of the adf.
    = > I want to change the existing lines.
    = > after changing lines save the changes by clicking on save button.
    pls can anyone suggest me how to code...

    Essentially you are saying, that you don't want to change the button, right? The rest of the sample is what you want.

    It should be easy to check:
    I guess as you build the table on a VO based on an OS like this done the updatable VO. If you drag the VO of the dataControl on the page like af:table (not the read only) then you only need to set the "EditingMode" property to "clickToEdit" and you simply clickinto a cell for editing.
    To get the 'Save' button, you drag the operation 'validation' of the DataControl on the page and drop it to a button. This button saves then any changes made since the last commit.

    Timo

  • First character left in file by reading the first line in text file

    When you use the function of reading text from a file file, I noticed that the 1st character is left in the file. I read the line correctly.

    When adding a 2nd line this character is in the file.

    Part vi code is attached.

    Any ideas?

    Thank you.

    Elik

    Can you attach a file of real data and tell us what you mean by "first character". The number of characters per line do you have?

    Can you tell us what you see in the modified file and what you expect to see.

    Everything seems good.

    1. Read you the first line and so the file pointer is just after the first line
    2. You set the size of the file at the end (seems unnecessary, because it does nothing). The file pointer is always right after the first line.
    3. You write the first line you read concatenated with a second line. It will be written on the current file pointer, i.e. after the existing line
    4. The first line is in the file twice, as planned.

    Setting the file size to the 'end' on an existing file does not have something useful. If you want to set the position of the file instead?

    Try to set the file position from and new data will be written at the beginning of the file.

Maybe you are looking for