10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You will see the output from the SQL commands in the Output tab.<br />

Creating the DatabaseTables Using Ant<br />

<strong>The</strong> database tables are automatically created by the create-tables task, which is called before<br />

you deploy the application with the ant deploy task. To manually create the tables, do the<br />

following:<br />

1. In a terminal window, navigate to tut-install/javaeetutorial5/examples/ejb/order/.<br />

2. Type the following command:<br />

ant create-tables<br />

Note – <strong>The</strong> first time the create-tables task is run, you will see error messages when the<br />

task attempts to remove tables that don’t exist. Ignore these error messages. Subsequent calls<br />

to create-tables will run with no errors and will reset the database tables.<br />

Building, Packaging, Deploying, and Running order In NetBeans IDE<br />

Follow these instructions to build, package, deploy, and run the order example to your<br />

Application Server instance using NetBeans IDE.<br />

1. In NetBeans IDE, select File→Open Project.<br />

2. In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/ejb/.<br />

3. Select the order folder.<br />

4. Select the Open as Main Project and Open Required Projects check boxes.<br />

5. Click Open Project.<br />

6. In the Projects tab, right-click the order project and select Run.<br />

You will see the following output from the application client in the Output tab:<br />

...<br />

Cost of Bill of Material for PN SDFG-ERTY-BN Rev: 7: $241.86<br />

Cost of Order 1111: $664.68<br />

Cost of Order 4312: $2,011.44<br />

Adding 5% discount<br />

Cost of Order 1111: $627.75<br />

Cost of Order 4312: $1,910.87<br />

Removing 7% discount<br />

Cost of Order 1111: $679.45<br />

Cost of Order 4312: $2,011.44<br />

Average price of all parts: $117.55<br />

<strong>The</strong> order Application<br />

Chapter 26 • Persistence in the EJBTier 721

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!