background image

Packaging the order Application

<< Creating the Database Tables | Running the order Application >>
<< Creating the Database Tables | Running the order Application >>

Packaging the order Application

4. Click the Run SQL button at the top of the editor pane.
You will see the output from the SQL commands in the Output tab.
Creating the Database Tables Using Ant
The database tables are automatically created by the create-tables task, which is called before
you deploy the application with the ant deploy task. To manually create the tables, do the
following:
1. In a terminal window, navigate to tut-install/javaeetutorial5/examples/ejb/order/.
2. Type the following command:
ant create-tables
Note ­
The first time the create-tables task is run, you will see error messages when the
task attempts to remove tables that don't exist. Ignore these error messages. Subsequent calls
to create-tables will run with no errors and will reset the database tables.
Building, Packaging, Deploying, and Running order In NetBeans IDE
Follow these instructions to build, package, deploy, and run the order example to your
Application Server instance using NetBeans IDE.
1. In NetBeans IDE, select File
Open Project.
2. In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/ejb/.
3. Select the order folder.
4. Select the Open as Main Project and Open Required Projects check boxes.
5. Click Open Project Folder.
6. In the Projects tab, right-click the order project and select Run Project.
You will see the following output from the application client in the Output tab:
...
Cost of Bill of Material for PN SDFG-ERTY-BN Rev: 7:
$241.86
Cost of Order 1111:
$664.68
Cost of Order 4312:
$2,011.44
Adding 5% discount
Cost of Order 1111:
$627.75
Cost of Order 4312:
$1,910.87
Removing 7% discount
Cost of Order 1111:
$679.45
Cost of Order 4312:
$2,011.44
The order Application
Chapter 26 · Persistence in the EJB Tier
723