Book Image

JDBC 4.0 and Oracle JDeveloper for J2EE Development

Book Image

JDBC 4.0 and Oracle JDeveloper for J2EE Development

Overview of this book

Table of Contents (20 chapters)
JDBC 4.0 and Oracle JDeveloper for J2EE Development
Credits
About the Author
About the Reviewer
Preface

Updating a Row


Next, we will update a row in the OracleWebRowSet object. Click on the Modify Web RowSet Page link in the ReadRow JSP. In the ModifyWebRowSet JSP click on the Update Row link. In the UpdateRow JSP specify the row to be updated and specify the modified values. For example, update the second row. Click on Apply.

The UpdateRow JSP invokes the updateRow() method of the WebRowSetQuery Java class. The WebRowSetQuery object is retrieved from the session object:

WebRowSetQuery query=( webrowset.WebRowSetQuery)
session.getAttribute("query");

In the updateRow() method the OracleWebRowSet object cursor is moved to the row to be updated:

webRowSet.absolute(rowUpdate);

The row values are updated with the updateString() method of the OracleWebRowSet object:

webRowSet.updateString(1, journal);
webRowSet.updateString(2, publisher);
webRowSet.updateString(3, edition);
webRowSet.updateString(4, title);
webRowSet.updateString(5, author);

Update the OracleWebRowSet object with the updateRow()...