EJB

xiaoxiao2021-03-14  206

EJB components are used to package business logic so that developers are no longer worried about programming, such as database access, transaction support, security, caches, and concurrent operations. In the EJB specification, it is managed by EJB container responsibility.

Enterprise Beans contains interfaces and classes. The client accesses the Beans method via the Enterprise Beans HOME interface and remote interface. The HOME interface provides a method of generating, deleting, and positioning Enterprise Beans, and a remote interface provides a way of service processing. At the time of deployment, the EJB container generates the corresponding class for the client to generate, delete, positioning, and business processing by providing access to Enterprise Beans based on these interfaces. Enterprise Beans class is a business method, a method and find method

Realization is provided, and if it is managed by Beans, it can also be implemented for its lifecycle methods.

Enterprise Beans has two: entity Beans and session beans. Session Beans Expressing Short Pairs of Clients

If you may include a database-based reading and writing. Session Beans can call themselves by calling JDBC, or can be called through entity Beans, and the session beans are entity Beans clients. Session beans's domains include meeting

The state is short. If the server or client is paralyzed, the session beans will disappear. This model is usually used with database programming languages, such as PL / SQL.

Entity Beans Expresses the data in the database and methods for data operations. Relationship database in employee information table

In each line in the table, there is a beans corresponding to. Entity Beans is transactional and long-term existence. As long as the data is kept in the database, the entity beans exists. This mode can be used in relational databases instead of just object databases.

The session beans can have state or no status. The stateful session beans contain session status values ​​with the client. The session status value is the instance field value of session beans plus all object values ​​available through session beans. Stateful session beans do not express permanently stored data, but these status can be accessed and changed according to the actions of the client.

The stateless session beans do not contain any status information for a specific client. They typically provide server operations that do not maintain any special state. There is less system resources required for stateless session beans. Status Session Beans is suitable for providing a general service or a business object for expressing a storage data sharing view.

ENTERPRISE Beans using EJB containers can access the database without using any JDBC 2.0 API, because the EJB container has made your corresponding processing. However, if you use Beans to manage persistence, or want to access the corporate information system instead of a relational database, you must write the corresponding code to be implemented.

If you use the Enterprise Beans to manage persistence by Beans to access the database, you must use the JDBC 2.0 API code to implement the lifecycle method of Beans to process data access and maintenance of data consistency between the data.

Although the Web layer transmits data between the HTTP or HTTPs, the EJB layer uses RMI-IIOP. RMI-IIOP is a comprehensive distributed computing protocol that allows all clients or Web layers to access enterprise beans through services directly accessing the EJB layer. These services include JDI for consulting and referring to Enterprise Beans, Java Messaging Services (JMS) for sending and receiving asynchronous messages, and JDBCs for accessing relational databases.

转载请注明原文地址:https://www.9cbs.com/read-129414.html

New Post(0)