Tutorial Index Page
Using the Session Bean
We are already familiar with looking up home interfaces and using them
to create beans, and then using beans. Everything is identical in
this case, but there is no method to find by a primary key.
There is a sample file included here that shows how to access the session
bean. Again, there are two versions of the file, SessionClientSample.java
for JDK 1.2 and SessionClientSample.java
for JDK 1.3. The JDK 1.2 version does not use PortableRemoteObject.
Remember to add your StockQuoteEjb.jar file to the classpath,
before compiling and using the sample client.
Try running the client program without the stock-quotes file being present.
This should cause the EJB to throw a java.io.IOException
to the client program. Now put the stock-quotes file in place and
run the program. Now it should correctly return the prices.
Exercise: Write and test a client program for your
bank-accounts EJB that lets you query balances, and credit and debit some
amounts to to the balances.
|
|
|