R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

EJB

EJB Projects

EJB Project 1

EJB Examples

EJB EXAMPLE

Implementation of Session Beans:
Previous Home Next

A Session beans (Stateless or State full) is implemented by a beans class and remote or local interfaces.

Client of a Session beans can execute within the same runtime environment or in a different runtime environment clients executing in same runtime environment use local interfaces to interact with Session bean and clients executing in a different runtime environment and to interact to a Session beans through it's remote interface.

Remote and Local interfaces contains methods which can be invoked on a Session bean. To define Remote & Local interfaces to Session bean @ Remote and @ Local annotation provide by EJB are used.

Example:

import javax.ejb.*;
@ Remote
public interface Adder
{
	public int add(int x, int y);
}

The Implementing for Session bean time in the using for Console Application, windows Application, web browser and web browser in the established in web application and then containing in the Remote interface and directly to target EJB Container and attach to Session bean. The Session bean interacting local client and local interface.

Bean Class for a Session beans implements Remote and local interface and annotation by @stateless and @ stateful annotation.

Example:

import javax.ejb.*;
@ Stateless
public class AdderBean implements Adder
{
	public int add(int x, int y);
	{
	return x+y;
}
}
Previous Home Next