Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the programming rules of EJB Session Bean

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about the EJB programming rules Session Bean how to understand, the editor feels very practical, so share with you to learn, I hope you can learn something after reading this article, do not say much, follow the editor to have a look.

Session Bean is used to implement business objects with specific business logic and cannot directly represent shared data in DB. The state of Session objects is not persistent and does not need to be written to DB. Session Bean implements the business logic of Bean, while remote access security parallelism and transactions are provided by shameful Bean containers.

Write rules for EJB:

1. Write an EntERPrise Bean:

1)。 There may be one or more ejbCreate methods.

2)。 The access control modifier must be public, not static

3)。 Parameter is a legal type of JavaRMI, and the modifier cannot be static or void.

4). The throws clause can include CreateException and other exceptions to the application.

5)。 Method cannot conflict with the EJB structure definition.

2.Home interface: defines the object EJB that the client needs to instantiate on the Create that the client can call.

The parameter and return type of the Create method must be of type RMI.

2). The Create method returns the Remote interface type (but the ejbCreate method returns void).

3). The throw clause of the Create method must include remoteException,CreateException.

3.Remote interface: defines the business methods that the client can call.

1)。 The methods in the remote interface must match the methods implemented in the Enterprisre Bean class.

The methods in the Remote interface must be the same as the implementation methods in the Enterprise Bean class.

3)。 Parameters and return types must be valid RMI types.

4) the throws clause must include java.rmi.remoteException.

Choose between statful and stateless Session Bean.

1.stateul is designed to maintain objects that represent client state and represent non-persistent storage. Represent the workflow between business objects.

It is generally used in the following examples:

1) maintain specific storage business objects.

2) objects that represent non-persistent storage.

3) represent the workflow between business objects.

2.stateless is designed to provide server-side behavior without specific user data. It is generally used in the following examples:

1) Modeling reusable service objects.

2) provide high performanc

3) operate multiple records at a time.

4) provide the viewpoint of DATE program.

The above is how to understand the programming rules of EJB Session Bean. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report