EJB Introduction
Program. Restrictions
Stateless Session Bean
Stateless ...(Example-1)
Stateful Session Bean
Stateful ... (Example-2)
Entity Beans
BMP Entity Beans
Config. DB (Example-3)
BMP (Example-4)
Bookmark This Site
|
Stateless Session Beans - Complete Project (Continue...)
Introduction
|
- To improve performance, you might choose a stateless session bean if it has any of these traits:
-
The bean’s state has no data for a specific client.
-
In a single method invocation, the bean performs a generic task for all clients. For example, you might use a stateless session bean to send an email that confirms an online order.
-
The bean fetches from a database a set of read-only data that is often used by clients. Such a bean, for example, could retrieve the table rows that represent the products that are on sale this month.
- Types of Enterprise Beans are
-
- Session Beans
- Stateless Session Beans
- Stateful Session Beans
- Entity Beans
- Bean Managed Persistent (BMP) Entity Beans
- Container Managed Persistent (CMP) Entity Beans
- Message-Driven Bean
CLICK HERE to download this complete example (zip file)
|
|
Steps to deploy and run this Stateless Session Bean Project
|
- Write a java program and name it as LoanHome.java
- Write a java program and name it as Loan.java
- Write a java program and name it as LoanBean.java
- Write a java program and name it as LoanServlet.java
- Write a html file and name it as Loan.html
- Set the path in the "command prompt"
-
set path=.;D:\progra~1\java\j2sdk1.5.0\bin;D:\Sun\AppServer\bin;
-
Set classpath=.;D:\progra~1\java\j2sdk1.5.0\lib;D:\Sun\AppServer\lib\j2ee.jar;
(OR) Set the path in the system itself. CLICK HERE for details
- Now compile the LoanHome.java, Loan.java, LoanBean.java, LoanServlet.java. CLICK HERE to see how to compile
- After the java programs are compiled successfully, you can close the command prompt.
-
Now goto Start -> Programs -> Sun Microsystems ->Application Server PE -> Start Default Server (wait till it start and then press any key). CLICK HERE to see how to Start the Server
- Next goto Start -> Programs -> Sun Microsystems ->Application Server PE -> Deploytool. CLICK HERE to see how to Start the Deploytool
Now in the deploytool,
- Goto File ->New -> Application
(Click the Browse button)
-
(Select the folder in the Look In dropdown box, and then give a file name StatelessBeanExample. Next click the New Application button)
(Click the OK button)
- Now goto File -> Save to save the file
- Now select File->New->Enterprise Bean command
- Click the Next button
- Next, click the Edit Contents button
- Select only the Loan.class, LoanBean.class, LoanHome.class files and click the Add button
- Click the OK button
- Click the Next button and then select LoanBean from the Enterprise Bean Class drop-down box, also type LoanBean in the Enterprise Bean Name textbox, select Stateless Session from the Enterprise Bean Types, and then select the LoanHome from the Remote Home Interface, and then select the Loan from the Remote Interface
- Click the Next button
- Select the No option button and then click the Next button
- Click the Finish button
|
|
Click Next To Continue ...
|
|
|