EJB is a standard for building server side components in JAVA. It specifies an agreement
between components and application servers that enables any component to run in any
application server. EJB components are deployable and can be imported in to an application server which hosts these components. EJB are not intended for client side they are server side components. They are specially meant for complex server side operations like executing complex algorithms or high volume business transactions.
between components and application servers that enables any component to run in any
application server. EJB components are deployable and can be imported in to an application server which hosts these components. EJB are not intended for client side they are server side components. They are specially meant for complex server side operations like executing complex algorithms or high volume business transactions.
There are three kinds of EJB’s:-
Session beans
Session beans are construct in EJB. They represent business logic of an application. They
represent a group of logical related functionality. For instance you can have a customer
session bean which can have functionality like customer interest calculation, customer
reporting, customer tax calculation etc. But as these functionalities logically belong to
customer they will be included in the customer session bean. In short session bean has
business logic.
Session beans
Session beans are construct in EJB. They represent business logic of an application. They
represent a group of logical related functionality. For instance you can have a customer
session bean which can have functionality like customer interest calculation, customer
reporting, customer tax calculation etc. But as these functionalities logically belong to
customer they will be included in the customer session bean. In short session bean has
business logic.
There are two types of session beans:-
Stateless: - they do not maintain state across method calls. So every time client makes a
call it’s like a new object from scratch.
Stateful:— These beans can hold client state across method invocations. This is possible
with the use of instance variables declared in the class definition. Every time the client
calls it they can get there previous states.
Stateless session bean provide greater scalability as EJB container does not have to
maintain state across method invocations. Storing state for EJB container is huge activity.
maintain state across method invocations. Storing state for EJB container is huge activity.
Entity beans
Entity bean represent persistent data in an EJB application. They provide object-oriented
abstraction to a relational database. When Session bean needs to access data it called the
entity beans. Entity beans do read, write, update and delete from tables. For instance you
have a customer table then you will have customer entity bean which maps to the table
and can do the CRUD (Create, Read, Update and Delete) operation to the customer
table. From architecture angle you can think entity bean as the data access layer of a
system.
Entity bean represent persistent data in an EJB application. They provide object-oriented
abstraction to a relational database. When Session bean needs to access data it called the
entity beans. Entity beans do read, write, update and delete from tables. For instance you
have a customer table then you will have customer entity bean which maps to the table
and can do the CRUD (Create, Read, Update and Delete) operation to the customer
table. From architecture angle you can think entity bean as the data access layer of a
system.
Message-driven beans
There are situations in project where you would like to communicate asynchronously
with some other systems. This is achieved by using message-driven beans. For instance
when user places order you would like to submit it asynchronously to the order system
and then move ahead with some other work. You would then later comeback after sometime
to see if the order is completely or the order system will notify you about the completion
of the order.
There are situations in project where you would like to communicate asynchronously
with some other systems. This is achieved by using message-driven beans. For instance
when user places order you would like to submit it asynchronously to the order system
and then move ahead with some other work. You would then later comeback after sometime
to see if the order is completely or the order system will notify you about the completion
of the order.
No comments:
Post a Comment