Updating Row in Database thru BMP

Hi,
I am writing session beans and BMP Entity bean to insert, Update, Delete rows into database tables.
Insert seems simple to me as I have to just call create() in Session Bean which will call ejbCreate() in BMP entity bean and a row will be inserted.
What should I do to update a row?
Or delete a row.
Thanks in advance.
Rajeev

Hi,
Strange question... :)
Somewhere nearby ejbCraete must be ejbRemove and findByPrimayKey(...).
If seriously, every Home or LocalHome has findByPrimaryKey method that returns the "row" - remote or local object. To update it you should just call setters for fields you want to update i.e. setName(...).
As about delete, there is ejbRemove for that in bean or remove(primaryKey) in Home interface.
Hope didn't miss anything
good luck

Similar Messages

  • Create new rows or update rows in database table

    I have few table in database.
    I catch some values in my bean. Now I must put that values in my database tables. Values are in different tables.
    How can I update tables in database? Ok I know that my solution is updateable (entity) viewObject but please ... some example or description are welcome!
    Thx.
    Message was edited by:
    sinnerman

    Hi Frank. I read developer guide but this is detail and if you can help ... thanx in advance.
    I put code ... in my bean ... I need to insert row in table and commit. Please if you can answer me what`s wrong?
    code:
    FacesContext fc = FacesContext.getCurrentInstance();
    Application app = fc.getApplication();
    //Find corresponding object where variable "bindings" reside
    DCBindingContainer binding =
    (DCBindingContainer)app.getVariableResolver().resolveVariable(fc,
    "bindings");
    //Find the data control by name from the binding container
    DCDataControl dcCtl =
    binding.findDataControl("TMFStudServiceDataControl");
    //Retreive application module
    TMFStudServiceImpl am =
    (TMFStudServiceImpl)dcCtl.getApplicationModule();
    ViewObject vo = am.getGetIdStudentAnketaPitanje();
    ViewObject studentAnketaOdgovor = am.getStudentAnketaOdgovor();
    while (j < my_list.size()) {
    t = (Object)lista.get(j);
    System.out.println("IdOdgovora: " + t.toString());
    vo.setNamedWhereClauseParam("p_id_odgovora", t.toString());
    vo.executeQuery();
    Row currRow = vo.next();
    System.out.println("IdStudentAnketaPitanje: +currRow.getAttribute("IdStudentAnketaPitanje"));
    //am.insertStudentAnketaOdgovor();
    Row newStudentAnketaOdgovor = studentAnketaOdgovor.createRow();
    studentAnketaOdgovor.last();
    studentAnketaOdgovor.next();
    newStudentAnketaOdgovor.setAttribute("IdStudentAnketaPitanje", 1);
    newStudentAnketaOdgovor.setAttribute("IdOdgovor", 2);
    studentAnketaOdgovor.insertRow(newStudentAnketaOdgovor);
    am.getDBTransaction().commit();
    }

  • Update rows in Database reading field in rows of selectoneListBox

    JDev 11.1.1.4, application JSF.
    I have a .jspx that contain a af:table with 20 rows. These rows are read from database.
    I have (in the same .jspx) a af:selectoneListBox with f:selectItems.
    I use drag and drop from table to selectoneListBox. I save into af:selectItems the first field of each row choice.
    Now, how can I put a button than when I press it, it makes a change in database (View Objects) passing as parameter the field reads in row of selectoneListBox.
    Thanks

    Thanks for your replay Kamaal,
    but I have thought another way.
    I'd like to write something like:
    update filea set field1='1' where field2 in (getSelectedItems())
    where getSelectedItems() contain the fields read in rows of selectoneListBox.
    But, I do not know where I have to write this sql statement and then how to execute it by pressing a button, maybe in the ViewObjectImpl ? and if yes, how?
    Thanks

  • Polling Strategy to get back inserted/updated rows from BPEL

    Hi,
    Can anybody have code to get back the newly inserted/updated rows from database table, using DbAdapter Polling Strategy from BPEL Process.

    Hi user559009,
    Could you please elaborate a bit more about what it is you need.
    If you create a Partner link that polls a table and then create a receive activity that uses the partner link the variable in the receive activity will contain the data from the table.
    Regards Pete

  • Jdev Database Adapter - polling updated rows

    Hello, I have a question reguarding the polling strategy available in the database adapter.
    I set it up and it works great with new inserted rows in the table.
    However, it doesn´t capture the updated rows!
    For instance, i have the following table:
    ID - NAME - AGE
    1 -John- 21
    2 -Mary- 25
    When I insert a new row, it is captured by comparing the last captured ID in the sequencing file.
    ID - NAME - AGE
    1 -John- 21
    2 -Mary- 25
    3 -Cindy- 20 <--------- New row
    But when i UPDATE an already existing row, it doesnt load the changed row!
    ID - NAME - AGE
    1 -John- 26 <----------- Age changed, but polling doesnt recognize it!
    2 -Mary- 25
    3 -Cindy- 20
    Is there a way to get this to work? Should I set an special option? Thank you very much.
    Im using jdeveloper 11g.

    Hi John, it depends on which type of polling strategy you are using to poll the new/updated records. You must have the necessary previleges to add the special field and creat triggers or your db team must have.
    i.Physical delete polling strategy: Cannot capture the UPDATE operations on the table.This because when the adapter listens to the table, when ever a record is polled, that record is deleted after the polling process. After polling the records, if it is not deleted, then the adapter knows that it’s a updated one but here when a record is polled, it is deleted. So when an adapter encounters a record, it’s a new record to the adapter though the record is updated before the polling cycle). So physical delete cannot capture UPDATED records.
    ii. Logical delete polling strategy: The logical delete polling strategy updates a special field of the table after processing each row (updates the where clause at runtime to filter out processed rows).The status column must be marked as processed after polling and the read value must be provided while configuring the adapter. Modified where clause and post-read values are handled automatically by the db adapter.
    Usage:
    <operation name="receive">
    <jca:operation
    ActivationSpec="oracle.tip.adapter.db.DBActivationSpec"
    PollingStrategyName="LogicalDeletePollingStrategy"
    MarkReadField="STATUS"
    MarkReadValue="PROCESSED"
    This polling strategy captures the updated records only if triggers are added.This is because when the record is polled, its status is updated to 'PROCESSED'. To capture this record if its updated, its status has to be 'UNPROCESSED'. So a trigger has to be added to update the status field to 'UNPROCESSED' whenever the record is updated. Below is the example.
    Ex:
    CREATE OR REPLACE TRIGGER nameOftrigger_modified
    BEFORE UPDATE ON table_name
    REFERENCING NEW AS modifiedRow
    FOR EACH ROW
    BEGIN
    *:modifiedRow.STATUS :='UNPROCESSED';*
    END;
    In this example, STATUS is the special field(of the polling table). When the record is updated, the trigger gets fired and updates the STATUS field to 'UNPROCESSED'. So when the table is polled, as this record's status is Unprocessed, this record ll be captured during polling.
    Other polling strategeis like "Sequencing Table Last Updated","Sequencing Table Last-Read Id" Polling strategy,etc also can be used to capture the updated records. In these strategies also, you need to add the triggers like the above. These need an extra helping table also to poll.
    Logical delete polling strategy is good enough to poll the updated records.
    Hope this helps.
    Thank you.

  • Database Adapter - Polling updated rows

    Hello, I have a question reguarding the polling strategy available in the database adapter.
    I set it up and it works great with new inserted rows in the table.
    However, it doesn´t capture the updated rows!
    For instance, i have the following table:
    ID - NAME - AGE
    1 -John- 21
    2 -Mary- 25
    When I insert a new row, it is captured by comparing the last captured ID in the sequencing file.
    ID - NAME - AGE
    1 -John- 21
    2 -Mary- 25
    3 -Cindy- 20 <--------- New row
    But when i UPDATE an already existing row, it doesnt load the changed row!
    ID - NAME - AGE
    1 -John- 26 <----------- Age changed, but polling doesnt recognize it!
    2 -Mary- 25
    3 -Cindy- 20
    Is there a way to get this to work? Should I set an special option? Thank you very much.
    Im using jdeveloper 11g.

    Hi John,
    I guess you're talking about BPEL? If so, try the BPEL forum for a better response.
    Best,
    John

  • ROW-00014: Cannot update row as the data in the database has changed

    We're having the problem below. We are trying to upgrade a 10g Oracle database via a linked server in SQL Server 2008.
    OLE DB provider "OraOLEDB.Oracle" for linked server "abc" returned message "ROW-00014: Cannot update row as the data in the database has changed".
    Mensagem 7343, Nível 16, Estado 4, Linha 1
    The OLE DB provider "OraOLEDB.Oracle" for linked server "abc" could not UPDATE table "[OraOLEDB.Oracle]".
    Can anyone help?
    Thank you.
    Edited by: user10641061 on 14/10/2011 18:48

    The columns that I want insert in oracle database have this data:
    JULIO DE SANT’ ANNA     KOLISNHG     1968-10-04 00:00:00.000     S     F     10     9     RUA, N° 999 / APT° 99999 RJ     TH     25410003     N°42.018      78550510     125296625     2178942326     2008-11-15 18:58:58.000
    Some of this data may be interfering with this insert?
    thank you
    Edited by: user10641061 on 15/10/2011 15:47
    Edited by: user10641061 on 15/10/2011 15:48

  • Obiee oracle gateway error while updating row count

    Hi ,
    OBIEE server 11.1.1.5 ,oracle server11g installed in linux 64bit,
    while updating row count in Admin tool i am getting the following error
    [NQODBC][SQL_STATE:HY000][nQSError:10058] A general error has occured.
    [nQSError: 43113]Message returned from OBIS.
    [nQSError:43093]An error occured while processing the EXECUTE PHYSICAL statement.
    [nQSError:17003]Oracle gateway error: OCIEnvNIsCreate or OCIEnvInit failed to initialize environment.Please check your Oracle Client installation and make sure the correct version of OCI libraries are in the library path.
    i am able to check the database from sqlplus it is working fine.
    Any suggestion highly appreciated plzzz

    Make sure your connection pool is valid and able to import or execute reports.
    If everything good as above said, in Physical layer database properties-> general tab choose the database version and try it once.
    If not
    Check the doc id 1271486.1
    Or
    To resolve the issue create a softlink (ln -s) in the <OracleBI>/server/Bin folder to link to the 32-bit Oracle Client Driver file.
    The example below shows how to perform a softlink from the 64 bit directory:
    cd /u10/app/orcladmin/oracle/OracleBI/server/Bin
    ln -s $ORACLE_HOME/lib32/libclntsh.so.10.1 libclntsh.so.10.1
    If helps mark

  • Updating Row in a Grid

    Hi All
        I m extracting data from SQL table onto xMII Dashboard using Grid template.I have one column named comments.
        I need that the supervisor using the Dashboard can change the comments as required and it should be reflected on the dashboard as well as It is updated in the database.
         Can anyone tell me how can I achieve this ? I am concerned whether I would be able to change an xMII Grid row ....
    Regards
    Amit

    Hi Amit,
    Add a cell selection event in your iGrid template definition
    e.g.
    <APPLET NAME="appDashBoard" WIDTH="100%" HEIGHT="250" CODE="iGrid" CODEBASE="/Illuminator/Classes" ARCHIVE="illum8.zip" MAYSCRIPT>
         <PARAM NAME="QueryTemplate" VALUE="/your/query/template">
         <PARAM NAME="DisplayTemplate" VALUE="/your/display/template">
         <PARAM NAME="InitialUpdate" VALUE="true">
         <PARAM NAME="CellSelectionEvent" VALUE="JavaScriptFunctionName">
    </APPLET>
    Create a query template to update new comment in database
    <APPLET NAME="appUpdateComment" WIDTH="1" HEIGHT="1" CODE="iCommand" CODEBASE="/Illuminator/Classes" ARCHIVE="illum8.zip" MAYSCRIPT>
    <PARAM NAME="QueryTemplate" VALUE="/update/comment">
    </APPLET>
    In your Java script function check whether the selected cell is part of the comment's column
    if (appDashBoard,getSelectedCellColumn() == 'Comment'){
       //capture new user comment
       var comment = prompt('Enter comment', '');
       //get record id from igrid for the selected comment
       var cellRow = appDashBoard.getSelectedCellRow();
       var rID = getCellValue(cellRow, columNumberOfID);
       var appUpdateCommentQry= appUpdateComment.getQueryObject(); 
       appUpdateCommentQry.setParam(1, rID);
       appUpdateCommentQry.setParam(2, comment );
       if(appUpdateComment.executeCommand()) {
       } else {
       appDashBoard.updateGrid(true);

  • I'm unable to connect to database thru cold fusion

    I'm unable to connect to database thru cold fusion. it
    sometiems give me an error that your uname is undefined , soemtimes
    it gives ur index page not found so i created index page also but
    still im unable to connect to database n update my records..plz
    help me out..im a fresher in cold fusion

    I am having a similar problem having CFMX 7.02 verify my SQL
    Server 2005 Data Sources.
    I am using the sa account for CF to access the db's. But i
    get the following error:
    Connection verification failed for data source: myDatabase
    java.sql.SQLException: [Macromedia][SQLServer JDBC
    Driver]Error establishing socket. Connection refused: connect
    The root cause was that: java.sql.SQLException:
    [Macromedia][SQLServer JDBC Driver]Error establishing socket.
    Connection refused: connect
    Every role in SQL Server has the sa grantor Grant enabled. I
    can also login to SQL Server with the sa account w/o a hitch.
    I don't know what else to do. The server information is set
    to the ServerName port 1433, datasource name and database name are
    the same as the database name in sql server, and the username and
    password are set for the sa account.
    Thanks!

  • How to find  latest updating row in a table

    Hi
    How to find latest updating row in a table

    ADF 7 wrote:
    SELECT *  FROM Table WHERE lastupdTimestamp = (SELECT MAX(lastupdTimestamp) FROM Table)lastupdtimestamp - holds and date an time of an records when it last updation takes place in table.
    lastupdtimestamp is a column in my table.And how will this make sense in the scenario I've described, where UserA does an update before UserB, but commits the update after UserB's commited update? And add UserC and UserD and a 1000 more users to this scenario where concurrent updates happen.
    What actual time does this lastupdtimestamp contain and represent? And why? How is that lastupdtimestamp used in business logic and processing? Or is it just a silly-bugger-let's-add-somekind-of-time column to that table that essentially meaningless?
    Not saying that one should never add such a timestamp based column. Simply that one needs to understand WHAT it contains and it needs to be SENSIBLY used within the data model.
    However, in my experience such columns are often slapped on afterwards, never featured in the actual data model designed, and is then used without a second though that the database and its data is a multi-user and multi-process system. And things happen at the same time. And things overlap (serialisation is the exception - not the rule).

  • Adding a new row to database and then modify it

    Hi there,
    Im pretty sure this is a simple matter but i am new to JDBC,
    i have an application where i create a new member in a database and then want to modify part of that members info (weather he pays for something monthly or annually)
    I can add the new member easily, and I create a unique ID and place him in the db.unigue ID assigned by Access db.
    Then i want to bring the same member back and alter his data, since I am inserting new data there is no resultsSet returned (am i right about this?)
    so how can I get the same member back and alter his data, or at least find out what his ID was so i can do a query for the same ID?
    cheers
    D

    because you talk about creating new row then I assume you know how to invoke the executeUpdate() method. You can change the field in your table with the UPDATE command. The sintaxt of UPDATE following your database system sintaxt. If you want to query the data in the table you can use the method excuteQuery(). i.e. executeQuery("SELECT * from tableName").

  • To Update rows in Table in OA Framework

    Hi All,
    I have one requirement to update the table.
    For the first time when User opens the form, nothing is stored in database for the user id.
    He opens the form and enter 5 rows and click on save button.So 5 rows get inserted in database. Each record is having unique key which is also the primary key.
    Now user relogin, this time initially inserted 5 records should be displayed and editable by user. Also he should be able to insert new row with unique key.
    After editing, when he again clicks on "Save" button, edted record should get saved in table with same unique key.
    How to achieve this.
    I am able to insert rows in table for the first time. I am not getting how rows will get updated with same unique row. And at the same user should be able to add new row also.
    As for unique row, I am using a sequence which is autoincremented for each row insertion..
    Please can anyone help me in this regard
    Thanks in Advance

    Hi Tapashray,
    Thanks for help..
    My requirement is same as what you said...
    Lets say I have one table with column as Emp_id, emp_name,address, phone_no.
    Emp_id is sequence which is auto incremented each time a row is added in table.
    Other fields are user enterable.
    Say for ex Manager logs in and create 4 employees for which emp_id auto generated as 1,2,3,4.
    He has entered other details through screen. When he clicks on "Save" buton, all details get saved in database.
    Now when he logs in again, he should be able to see all details of 4 employees and details should be editable.
    Now suppose he change the emp_name column of first employee with emp_id =1 and clicks on "Save" button, then a row in database should get update with same emp_id =1.
    Also on the screen, he should be able to create new employees with new and next emp_id.
    Hope you got my requirment.

  • ExecuteBatch(): number of successfully updated rows

    Hello everybody:
    Here is a simple but often a repeated question in java forums:
    Requirement:
    1.To read a flat file that has many rows of data.
    2.Parse the data and update the database accordingly.
    3.Find the number of successfully updated rows.
    Approach:
    After reading the file and parsing its data,
    - use PreparedStatement
    - use executeBatch()
    I found this as unadvisable to use executeBatch() as its implementation is
    inherently driver specific. The executeBatch() returns an array of update counts.
    Now,can any one tell me, what is the best way to trace the number of successfully
    (and unsuccessfully) updated rows by using this count?
    Is there any other way to achieve the same by not using executeBatch()?
    Can any one share a snippet of code to achieve this specific functionality?
    [Need is to log the number of unsuccessful attempts along with their
    corresponding rows of data].
    Thanks & regards,
    Venkat Kosigi

    executeBatch submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. The int elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method executeBatch may be one of the following:
    -- A number greater than or equal to zero indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution
    -- A value of -2 indicates that the command was processed successfully but that the number of rows affected is unknown
    If one of the commands in a batch update fails to execute properly, this method throws a BatchUpdateException, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands.
    If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will contain as many elements as there are commands in the batch, and at least one of the elements will be the following:
    -- A value of -3 indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails.
    return values have been modified in the Java 2 SDK, Standard Edition, version 1.3 to accommodate the option of continuing to proccess commands in a batch update after a BatchUpdateException obejct has been thrown.
    Throws BatchUpdateException (a subclass of SQLException) if one of the commands sent to the database fails to execute properly or attempts to return a result set. The BatchUpdateException getUpdateCounts() method allows you to known the element who caused the fail identified by a -3 value.
    -- So, if you have a succesfully result, look for at the executeBatch returned array ( #values >= 0 ) + ( #values == -2 ) = successes
    and if you have not a succesfully result, catching the BatchUpdateException take the array returned by the getUpdateCounts() method, and look for the position in which array values are -3. You could take the data at this position on batch and log it.
    -- Other way to insert a bulk copy on database is to use a bcp command ( it�s not java, bcp is an independent command ) that allows you to do bulk inserts from file, indicate an error file, bcp will give to you as result a file with those lines not where inserted.
    I hope have help you.;)

  • Error - Update Row Count in Oracle BI Administraton Tool

    Hi Everyone,
    I am running XE on the same machine that BI Administrator is running on. I them imported the HR scheme on the Physical Layer. As I try to update row count, I am getting errors:
    NQSError : - 10058 , A general error occurred
    An error occurred while executing the Physical Statement
    Oracle Error 3114 - Not connected to oracle OCI CALL OCIstmtexecute
    SQL statement preparation failed.
    I am connecting via odbc, but as my connection pool in the physical layer, I have tried all the available type of connection pool, and it does not work. I still get the same error.
    Does anyone have any ideas?
    Thanks,

    Well, could it then be that you are using a different user to connect to through the connection pool? If so, then you have to set the connection pool to prefix the tables with the schema name. I don't have access to the admin tool at the moment to point out exactly how that is done, but at least you right-click on the connection pool, choose properties and there you check a check box that suggests prefixing tables.
    The reason here is that the connection pool connects to the database using some username, and all queries are executed as this user. This user then has to have SELECT privileges on all the tables you have imported (which the user does of course if the tables can be found in the same schema), but if some tables have been imported from other schema then the server has to prefix the tables with the correct schema name.
    Hope this helps!
    Borkur

Maybe you are looking for