Skip to content

Build Code for the Insert Button Event Handler to Insert a New Course – ORACLE DATABASE PROGRAMMING WITH JAVA

Menu
  • Contact Us
Menu

Build Code for the Update Button Method to Update Course Records – Develop Java Web Services to Access Databases

Posted on 2024-04-212024-08-24 by Patricia Carey

9.15.6   Build Code for the Update Button Method to Update Course Records

The function of this method is to update an existing course record when the Update button is clicked by the user. The existing course record will be updated on the Course Table in our sample Oracle database when this method is complete.

As we discussed in previous sections, all columns for the selected course record will be updated except the course _ id column, since it is a primary key and a cascaded update setup has been selected when we built this database. A very complicated update operational sequence would be executed if that primary key were updated. A much easier way to do that update is to insert a new course record with a new course _ id.

To make thing simple, let’s modify our project WinClientCourse _ Insert to make it our new project, WinClientCourse _ UpdtDelt. Perform the following steps to build our new Windows-based project, WinClientCourse _ UpdtDelt:

1) Browse to our project WinClientCourse _ Insert, which can be found in the folder Class DB Projects\Chapter 9 in the Students folder on the CRC Press ftp site (refer to Figure 1.2 in Chapter 1), and copy and then save it to any local folder in your machine.
2) Open NetBeans IDE 12.0 and right-click WinClientCourse _ Insert from your local folder and select the Copy item from the popup menu.
3) On the opened Copy Project wizard, change the project name to WinClientCourse _ UpdtDelt in the Project Name box, select your desired location from the Project Location box, and click on the Copy button.

FIGURE 9.95   The completed code for the UpdateButtonActionPerformed() event handler.

The main source file, CourseFrame.java, in our Source Packages folder may generate some errors when this new project is created. The reason for that is due to a Web Reference issue. To fix this error, build and deploy our Web Service application project, WebAppCourse, and then rebuild our new project, WinClientCourse _ UpdtDelt.

Now let’s first build the code for the Update button’s event handler. In the opened Design view of the CourseFrame form window, double-click on the Update button to open its event handler. Enter the code shown in Figure 9.95 into this event handler. Let’s have a closer look at this piece of code to see how it works.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • August 2024
  • April 2024
  • March 2024
  • January 2024
  • September 2023
  • May 2023
  • January 2023
  • October 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • January 2022
  • November 2021
  • September 2021
  • July 2021
  • May 2021
  • March 2021
  • January 2021
May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Aug    
  • Creating the Catalog Database
  • Creating the Shard Catalog
  • Exams of Oracle
  • GDS Components
  • GDS Restrictions, License, and Compatibility
  • Oracle Certification Exams
  • Oracle Sharding Workshop
  • Build Code for the Insert Button Event Handler to Insert a New Course 2 – Develop Java Web Services to Access Databases
  • Build Code for the Insert Button Event Handler to Insert a New Course – Develop Java Web Services to Access Databases
  • Build Code for the Update Button Method to Update Course Records – Develop Java Web Services to Access Databases
  • Build Code for the Update Button Method to Update Course Records 2 – Develop Java Web Services to Access Databases
  • Build Code for the Delete Button Method to Delete Course Records – Develop Java Web Services to Access Databases
© 2025 Build Code for the Insert Button Event Handler to Insert a New Course – ORACLE DATABASE PROGRAMMING WITH JAVA | Powered by Minimalist Blog