The difference between entity beans and session beans in J2EE

xiaoxiao2021-03-05  22

A session bean represents a short session with the client program, and may perform database read and write operations. A session bean may call JDBC yourself, or it may use Entity Beans to complete this call. In this case, this session bean is the customer of the Entity Bean. A session bean domain contains a session state and is short. If the server or client crashes, the session bean is lost. This mode is usually used on database programming languages ​​like PL / SQL. An Entity Bean represents data in a database and a method acting on the data. In the employee information table in a relational database, each line has a bean to represent. Entity Beans is transaction and is long life. As long as the data is left in the database, the Entity Bean exists. This mode can be easily used for relational databases, not limited to object databases. The session beans may be stateful or stateless. A stateful session bean contains a session status representative of the client. This session state is the domain value of the session bean instance plus all objects referenced by these domain values. There is a status session beans that does not represent data in a persistent data store, but it can represent and update data on behalf of the client. The stateless session beans do not have any status information for a particular client. They are often used to provide server-side behavior that does not maintain any particular state. There is no state Session Beans requires fewer system resources. A business object that provides a general service or a shared view for indicating the stored data is an example of stateless session beans.

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

New Post(0)