Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]() ![]() |
Part 2 Developing Applications by APIs | > Chapter 9 Developing Java Applications | > 9.3 How to Use Java APIs | > 9.3.3 Updating Data |
Use the prepareUpdateRecordID method to update XML documents.
The Java APIs use record IDs to update data. Before updating data, use the getRecordID method to obtain the record IDs of the data to be updated. The process of using a record ID to update an XML document refers to replacing an existing XML document with a new XML document. It is not possible to update part of the data contained in an existing XML document.
The following diagram shows the process for updating data specifying a record ID.
ShunConnection con = new ShunConnection(); ShunPreparedRecordID prid = con.prepareUpdateRecordID(); (1) prid.add(recordID, updateData); (2) prid.updateByRecordID(); (3) prid.close(); (4) con.close(); |
The prepareUpdateRecordID method is used to create a ShunPreparedRecordID object.
The add method is used to specify the record ID and the data to be updated. The record ID is obtained using the getRecordID method.
Multiple record IDs and items of data to be updated can be specified with the add method. If the same record ID already exists, both the record ID and the data to be updated will be overwritten if that record ID is specified again.
By specifying multiple record IDs and items of data to be updated with the add method, multiple XML documents can be updated at once.
Use the updateByRecordID method to execute the update process.
Use the close method of the ShunPreparedRecordID object to release the object when it is no longer required.
The following are entry examples available when Studio is used.
String recordID = dataBean.getDetailButton(); ShunConnection con = new ShunConnection(); ShunsakuAccessController controller = new ShunsakuAccessController(con); controller.update(recordID, updateData); con.close(); |
public void update(String recordID, String updateData) throws ShunException { ShunPreparedRecordID prid = con.prepareUpdateRecordID(); (1) prid.add(recordID, updateData); (2) prid.updateByRecordID(); (3) prid.close(); (4) } |
Contents
Index
![]() ![]() |