13 Technology--EJB Entity beans from the Java EE

Source: Internet
Author: User

Overview:

entity beans are different from the session bean, and the entity bean is persistent, even if the application ends, it still exists. It allows shared access, with a primary key.


Composition:


1) native (local) interface

Local access to EJBS is only available if the EJB is in the same application as the customer. When used, it can be used concurrently with the remote interface.

It optimizes access to EJBS, bypassing RMI.

2) Remote interface

The biggest difference from the local interface is that the remote interface can be accessed from anywhere .


Named:

use a normal name if you use only one of the local or remote interfaces. such as HelloWorld and Helloworldhome.

If you are using both interfaces, use ' Local ' or ' Remote ' as the interface prefix. For example

Helloworldlocal,helloworldLocalHome

Helloworldremote,HelloWorldRemoteHome.


3) Primary Key

An EJB that uniquely identifies an entity. Consists of one or more persistent fields of an entity bean, which is specified in the deployment description file.


Type:

1) CMP Entity bean

-- container-managed persistent entity Bean

Characteristics:

Controlled by the container, the container can achieve advanced data buffering and complex relationships between ejbs.

2) BMP Entity Bean

--The operation code for the data is provided by the Bean author.

Characteristics:

You need to write all the persistence logic manually in the bean, which makes debugging difficult. However, it can represent complex persistent data.


Two types of comparisons:



Life cycle:

The life cycle of an entity bean has three states:Does not Exist --No,pooled--into the pool, ready--in place.

Pool pooled is the move of the created entity bean to the available instance pool.


The conversion and method calls between these three states are as follows:



Summary:

The content of the entity bean is also very miscellaneous, much with the previously learned things, the use of comparative analysis, it will be much easier. such as the comparison between the local interface and the remote interface, CMP and BMP comparison.

13 Technology--EJB Entity beans from the Java EE

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.