ITEC 340 – Spring 2006

Homework 7

 

Optimistic Locking

 

Consider the campers table from homework 3:

 

Campers

camperID

last

first

Gender

address

city

state

zip

homephone

budget

1

Jones

David

M

1 Main Street

Blacksburg

VA

24060

(540) 333-9866

 $        100.00

2

Davenport

Billy

M

2 Eastern Ave.

Richmond

VA

23454

(804) 222-6789

 $        200.00

3

Smith

Sally

F

8 West Street

Radford

VA

24142

(540) 673-8894

 $        150.00

 

 

Add a balance column to the campers table with the understanding that budget is the amount a camper is originally given to spend and balance is the amount remaining, equal to the budget minus the sum of all charges in the system for that camper.

 

Modify your JAVA program from homework 4 to implement optimistic locking with mutation detection.  Test your application the same way I will, by following this protocol:

 

Open two instances of your program

Open a camper in the first instance

Open the same camper in the second instance (this should be allowed)

Submit a new charge from the first instance (this should be allowed and the balance should update)

Submit a new charge from the second instance (mutation of the camper row should be detected, the user warned, and appropriate action taken)

 

Create an RU07 folder in your ITEC 340 submissions folder on Neelix and submit your .java files by 6:00 p.m. on April 7th.