Ejb

  • Uploaded by: Adarsh
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ejb as PDF for free.

More details

  • Words: 1,103
  • Pages: 4
What is meant by Enterprise Java Beans (EJB) ? Enterprise JavaBeans (EJB) is a server side component architecture that enables and simplifies the process of building enterprise class distributed object applications in Java

• JavaBeans and EJBs • • • • • • • •

JavaBeans are development components and are not deployable JavaBeans is not deployable because JavaBeans is not a complete application JavaBeans do not need a runtime environment in which to live JavaBeans can have a container or not EJBs are deployable components EJBs are complete applications EJBs need a runtime environment to live EJBs need a container

• Applets, Servlets and EJBs • • Applets can be deployed in a Webpage and the browser’s applet viewer provides a runtime container for the applet • Servlets can be deployed in a Web Server and the web server’s servlet engine provides a runtime container for the servlet • Enterprise Java Beans can be deployed in a Application Server and the application server provides a runtime container for the Enterprise Java Beans • The difference between applets, servlets and enterprise java beans is the domain of which each component type is intended to be a part • Enterprise Java Beans are server side components that are meant to perform server side operations such as executing complex algorithms or performing high volume business transactions • Server side components needs to run in a highly available, fault tolerant, transactional and multiuser secure environment • An application server provides highend server side environment for the enterprise java beans and provides the runtime containment necessary to manage enterprise java beans

Enterprise Java Beans •

An Enterprise Java Beans is a server side software component that can be deployed in a distributed multi tier environment • The client of a enterprise java beans can be a servlet, an applet or even another enterprise java bean • The client request to a bean can result in a whole chain of beans being called resulting in subdividing a complex task into subtasks handled by simple beans

• •

There are two different kinds of enterprise java beans the session beans and the entity beans

Session Beans •

Session beans are business process objects that implements business logic, business rules and workflow • Session beans are reusable components that contain logic for business processes • A session bean can perform price quoting, order entry, video compression, banking transactions, stock trades, complex calculations etc. • Session beans are called session beans because they live for about as long as the session of the client code that is calling the session bean exists • Session beans are usable by one client at a time and they are not shared between clients • The EJB container is responsible for managing the lifetime of beans • The container destroys session beans at the appropriate time • There are two subtypes of session beans the stateful session beans and stateless session bean

Stateful Session Beans •

Some business processes can be performed in a single method request other business processes can last across multiple method requests and transactions • A stateful session bean is a bean that is designed to service business processes that span multiple method requests or transactions • The stateful session beans retain state on behalf of an individual client so in a stateful session bean’s state is changed during a method invocation the same state will be available for the client in the following invocation

Entity Beans • •

An Entity bean is a component that represents persistent data Entity beans represent real data objects such as customers, products employees, bank accounts, orders, stock portfolios etc. • Entity bean do not contain business process logic rather they model data • Session beans use entity beans to represent the data session bean uses • The Entity bean is an object oriented in memory view of a database

• It is possible to read an entire set of data out of a database at once into an in memory entity bean component and then manipulate this entity bean by calling methods on it • An entity bean implements the data access logic layer in a multi tier architecture • Entity bean survive critical failures such as application server crashing because entity beans are representation of data in a permanent database • Entity beans have a life cycle much longer than Session beans even years depending on how long data sits in the database • Multiple clients can use Entity beans simultaneously • One client can isolate from another by using transactions • Transactions guarantee multiple clients to perform persistent operations independently of one another • Entity beans can be used with legacy database where data is already inside • The data that entity beans model could exist in a database before a company decided to employ Enterprise Java Beans • Database records can be read in and interpreted as objects in almost any language and EJB takes advantage of this and allows for the transformation of a database’s data into Java object • There are two subtypes of entity beans the bean managed persistent entity beans and container managed persistent entity beans

Bean Managed Persistent Entity Beans •

Entity beans are persistent components because their state is saved to a secondary storage such as a relational database • A bean managed persistent entity bean is an entity bean that must be persisted by the component developer • The component developer must write code to translate the in memory fields into an underlying data store such as a relational database • The component developer must handle the persistent operations including saving, loading and finding data within the entity bean

Container Managed Persistent Entity Beans •

In Container managed persistent entity bean the container provides an automatic persistence for the entity beans • The container performs every function including saving loading and finding component data • The developer just describe what should be persisted to the container and it will persist for the developer • The container gives theoretical database independence allowing the developer to switch one data store for another • The EJB containers perform a wide variety of mapping functionality



• • • Session Beans versus Entity Beans • •

How to decide what to put in a session bean and what to put in an entity bean • The key difference between the two are that session bean represent business processes and business logic and entity bean holds permanent business entities such as businesses data and data related logic • Consider an example where a customer wants to order 15 workstations

Related Documents

Ejb
November 2019 25
Ejb
May 2020 13
Ejb
May 2020 11
Ejb
November 2019 22
Ejb
November 2019 25
Ejb
November 2019 17

More Documents from ""