Entity beans in java

download Entity beans in java

If you can't read please download the document

Transcript of Entity beans in java

Slide 1

Entity Bean In Java

Hiren JamodDepartment Of ComputerScienceSaurastra University-Rajkot

ENTITY BEANSEnterprise Beans which represent persistent data stored in a storage medium, such as a relational database.Persists across multiple sessions and can be accessed by multiple clients.Each instance of the entity bean represent a row in the tableEJB container creates instances of an entity bean and is responsible for loading data in an instance and storing the information (data) back into the database.

ENTITY BEANSThe persistent mechanisms that enable you to perform these database manipulations, such as serialization, Object/Relationship (O/R) mapping to a relational database and support for JDBC are built-in the entity bean model

CHARACTERISTICSPersistenceImplies that its state exists even after a client stops accessing an applicationThe persistent data remain intact even after the storage shuts downShared AccessMultiple clients can share one entity bean by using separate instances of the entity beanEJB Container maintains data consistency by synchronizing entity bean instances with the databaseTo maintain data consistency, the entity beans work within a transaction

CHARACTERISTICSPrimary KeyEach Entity bean has unique identifier; is known as Primary Key that enables the client to locate the exact entity bean RelationshipsLike the data of a relational database, the entity beans are also elated to each other

LIFE CYCLE OF ENTITY BEANS

LIFE CYCLE OF ENTITY BEANSInitially, the beans do not existWhen the Application server this stage to the Pooled stageWhen the server is first started, several bean instances are created and placed in the pool.A bean instance in the pooled state is not ties to particular dataAt this stage, the beans are referred as passivated.The bean remains in this stage till the client does not make a request for it or the container does not activate it.

LIFE CYCLE OF ENTITY BEANSThe beans business methods can be invoked when the bean is at the ready stage.It remains at this stage till the client calls its remove method or the container passiveness it if the bean has been lying idle for sometimes

EJB Source CodeHome Interface (extends EJBHome)Create - Find (for Entity)Factory PatternRemote Interface (EJBObject)Business MethodsProxy PatternBean Class (EntityBean)Deployment descriptor (ejb-jar.xml)

Craete Application

Give Name of Craete Application

Add Session Bean

Give Name of Session Bean

Add Persistence Unit

Give Name Persistence Unit

Add Entity Class

Add Reference into web.xml

Decler Interface

Define Interface and override method

Define Entity BeanClass

Define index page

Define index page

Define index page

Define index page

Special Thanks T0 Amit SirTo give me opportunity to represent my presentation. By hiren jamod