Entity Beans

  • July 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 Entity Beans as PDF for free.

More details

  • Words: 299
  • Pages: 15
Entity Beans

Entity Bean  





Models data Represents real data objects, such as customer, products, or employees Does not contain business process logic Knows how to persist itself

Features    

Long-lived Survive failures View into data store Single Threaded

Entity Bean’s Components 

Remote interface 



Home interface 



Interface to entity beans class on which clients invoke Clients create, find, and destroy entity beans

Bean class 

Models persistent data

Entity Bean’s Components 

Primary bean class 



Unique identifier for your entity bean

Deployment descriptor  

Contains entity bean’s properties Properties will be used by the container

Entity Beans 

Two ways to persist entity beans:  

Bean-Managed Persistent (BMP) Container-Managed persistent (CMP)

BMP 



Developer must handle the persistence Developer must write code to take the in-memory data and store them into an underlying data store

CMP 

The container/server handles the persistence layer

Creating Entity Bean ejbCreate() Is used to create underlying data  May have different parameters  Must have a corresponding create() method in home interface Example: 

public AccountPK ejbCreate(String accountID, String owner) … public Account ejbCreate(String accountID, String owner) …

Finding Entity Beans – ejbFind() All finders start with ejbFind  Must exist at least one called ejbFindByPrimaryKey()  May have different names and parameters Example: 

public Enumeration ejbFindAllProducts() … public Enumeration findAllProducts() …

Destroying Entity Beans – ejbRemove()  



Will remove the database data Has a corresponding remove() method in home interface Will not be called if entity bean times out

Entity Context – setEntityContext() 

Represents the environment of the entity bean

getEJBObject() 

Returns the EJBObject associated with the entity bean

getPrimaryKey() 

Identifies which database data the entity bean is associated with

Related Documents

Entity Beans
July 2020 14
Weak Entity
December 2019 40
Mcl Beans
October 2019 8
Ind Entity
November 2019 22
Java Beans
November 2019 22
Red Beans
November 2019 8