3.3. Stand-alone Java Application Client

Well, we've certainly done a lot of work to create and deploy our EJB. Now let's show you a client that uses it.

Our first example is a stand-alone Java application that runs on a client machine. We use a command-line interface to keep the client simple. The program accesses our Loan EJB running in the business tier, possibly on a different machine.

The client program hard-codes loan values and invokes methods in the Loan remote interface. We create a Loan Value Object (LoanVO) with $90,000 for the loan amount, 6.85 % for the interest rate, and 15 years for the term. Because we don't provide a start date, the LoanVO constructor uses today's date.

The first part of the client program calls monthly_payment() ...

Get Enterprise JavaBeans™ Component Architecture: Designing and Coding Enterprise Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.