SQL/MX Guide to Stored Procedures in Java (G06.24+, H06.03+)

Sample SPJs
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
A-3
Class Files and Java Methods
Class Files and Java Methods
The SPJ methods are stored in these class files:
Sales Class on page A-3
Payroll Class on page A-7
Inventory Class on page A-9
These class files are coded as Java source files and use JDBC/MX to access a
NonStop SQL database. For information about JDBC/MX, see the JDBC Driver for
SQL/MX Programmers Reference.
Sales Class
The Sales class contains these SPJ methods, which are useful for tracking orders
and managing sales:
The lowerPrice() method determines which items are selling poorly (that is,
have less than 50 orders) and lowers the price of these items in the database by
10 percent.
The numDailyOrders() method accepts a date and returns the number of
orders on that date to an output parameter.
The numMonthlyOrders() method accepts an integer representing the month
and returns the number of orders during that month to an output parameter.
The totalPrice() method accepts the quantity, shipping speed, and price of an
item, calculates the total price, including tax and shipping charges, and returns the
total price to an input/output parameter.
The Sales.java source file in SampleSPJs.jar contains the code shown in
Example A-1 on page A-4.