Home | Download | PDF | API | FAQ | Search | Feedback | History

> ## Building and Running order

> This section describes how to build, package, and run `order`.

> ### Creating the Database Tables

> 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 navigate to

> `<``INSTALL``>/javaeetutorial5/examples/ejb/order/`

> 2. Enter 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 reset the database tables.

> ### Building and Packaging the Application

> To build the application components of `order`, enter the following command:

>     ant

> This runs the `default` task, which compiles the source files and packages the application into an EAR file located at `<``INSTALL``>/examples/ejb/order/dist/order.ear`.

> ### Deploying the Application

> To deploy the EAR, make sure the Application Server is started, then enter the following command:

>     ant deploy

> After `order.ear` is deployed, a client JAR, `orderClient.jar`, is retrieved. This contains the application client.

> ### Running the Application

> To run the application client, enter the following command:

>     ant run

> You will see the following output:

>     ...
>     run:
>       [echo] Running appclient for Order.

>     appclient-command-common:
>       [exec] Cost of Bill of Material for PN SDFG-ERTY-BN Rev: 7:
>         $241.86
>       [exec] Cost of Order 1111:  $664.68
>       [exec] Cost of Order 4312:  $2,011.44

>       [exec] Adding 5% discount
>       [exec] Cost of Order 1111:  $627.75
>       [exec] Cost of Order 4312:  $1,910.87

>       [exec] Removing 7% discount
>       [exec] Cost of Order 1111:  $679.45
>       [exec] Cost of Order 4312:  $2,011.44

>       [exec] Average price of all parts:  $117.55

>       [exec] Total price of parts for Vendor 100:  $501.06

>       [exec] Ordered list of vendors for order 1111
>       [exec] 200 Gadget, Inc. Mrs. Smith
>       [exec] 100 WidgetCorp Mr. Jones

>       [exec] Counting all line items
>       [exec] Found 6 line items

>       [exec] Removing Order 4312
>       [exec] Counting all line items
>       [exec] Found 3 line items

>       [exec] Found 1 out of 2 vendors with 'I' in the name:
>       [exec] Gadget, Inc.

>     BUILD SUCCESSFUL

> Note: Before re-running the application client, you must reset the database by running the `create-tables` task.

> #### The all Task

> As a convenience, the `all` task will build, package, deploy, and run the application. To do this, enter the following command:

>     ant all

> ### Undeploying order

> To undeploy `order.ear`, enter the following command:

>     ant undeploy