ITEC 340

Homework 7

 

In homework 5 you developed a database schema for a sailboat charter company.  For homework 7 you will use JAVA and JDBC to construct an application that allows for customer information maintenance.   Your completed application should look approximately like the screen shot below:

 

 

 

Behavior:

 

The initial state is for the SSNO textbox and the Retrieve button to be enabled.  All other controls should be initially disabled.  To retrieve a customer the user enters an SSNO and then clicks the Retrieve button.  If the retrieval is successful then:

 

   The other text boxes will fill with data.

   The SSNO will still display but will be disabled.

   The Retrieve button will be disabled.

   The Save and Cancel buttons will be enabled.

   The message area should report “Customer found.”

 

If the requested customer is not found in the database the state of the buttons and textboxes should not change but a message in the message are should report “Customer not found”.

 

Once data is retrieved the user can change all information except for the SSNO.  After making changes the user can click either the Save or Cancel buttons.  If the Save button is clicked then:

 

    The data will be pushed back into the database.

    The SSNO text box will be cleared and enabled.

    All other text boxes will be cleared and then disabled.

    The Save and Cancel buttons will be disabled.

    The message area should display “Customer information saved.”

 

If the cancel button is pressed then:

 

    The data on the screen will NOT be pushed back into the database.

    The SSNO text box will be cleared and enabled.

    All other text boxes will be cleared and then disabled.

    The Save and Cancel buttons will be enabled.

    The message area should display “Customer changes canceled.”

 

There should be no JDBC in your GUI.  This homework is worth 20 point so Get-R-Done.  Submit your .java files to an RU07 folder in the dropbox by midnight on Thursday Nov. 17th.  DO NOT submit the Oracle library.

 

Homework 8:

 

Add a “New Cust.” button into your GUI.  The button should be initially enabled.  If the user enters a SSNO that already exists and then clicks the New Cust button the application should do nothing except to display the message “Customer already exists” in the message area.  If the user enters a SSNO that does not exist:

 

   The SSNO will still display but will be disabled.

   All other textboxes will be enabled

   The Retrieve and New Cust buttons will be disabled.

   The Save and Cancel buttons will be enabled.

   The message area should report “Please Enter and Save Data.”

 

From that point the application should appear to work as before.

 

The New Cust button should also be disabled after a successful retrieval and enabled after a successful save. 

 

Submit your .java files to an RU08 folder in the dropbox by midnight on Wednesday Nov. 30thth.  DO NOT submit the Oracle library.

 

Homework 9:

 

Implement an optimistic locking strategy for your customer application.  One suggested way to do this would be:

 

1)      Add a CustChangeNum field to your customer table with a default value of 1.

2)      Add a trigger which increments the CustChangeNum whenever an update to that row occurs.

3)      Check the CustChangeNum field for mutation before saving changes.  Make sure that you lock the row before checking for mutation.  To do this you will need to use the FOR UPDATE option of the select command and you will need to turn AUTOCOMMIT off.

 

In cases where mutation is detected an attempt to SAVE should be abandoned and a message should be placed in the message indicating this.

 

Submit your .java files to an RU09 folder in the dropbox by midnight on Tuesday Dec. 6thth.  DO NOT submit the Oracle library.

 

 

Extra Credit:

 

Add a table to the bottom of the customer application that shows the charters in the system for that customer.

 

Submit your .java files to an RU20 folder in the dropbox by 5:00 on Friday Dec. 9thth.  DO NOT submit the Oracle library.