My EJB learning course (2)

zhaozj2021-02-16  59

Let's talk about it, Bromon said it is a little horrible. I don't know the authenticity of the source. If I think people don't want to go to the EJB3. Oh, but I still have to thank Bromon and my iron. My needle, my first article finally saw it, I hope more and more people will join! J

Chapter 1 EJB Development

EJB's role: (specified 6 kinds of development and deployment roles)

l Enterprise Bean Provider (Enterprise Bean Provider)

The task tasks are as follows:

1. Write the main interface of the bean.

2. Write the BEAN's component interface to declare the various business methods required by the application.

3. Write the implementation class that implements various business methods defined in the remote interface.

4. Write a deployment description item.

5. Package.

In fact, writing EJB programmers. As for what is the primary interface, what is the component interface, what is the implementation of the class! Let's die first!

l Application Assembler: It is actually a person who is working with a BEAN provider. Nothing is very useful, also known as industry experts! (just kidding)

l Deployer

l System administrator

l EJB service provider, container provider (two in the book, but I think they should be the same, at least temporarily the same thing)

In fact, it is coming back, some people are not very important, people we have to do are enterprise bean providers.

Develop the first EJB

Happy, I finally have a HelloWorld!

Everyone must remember the few elements of the bean provider! It is very important to expand between the few elements.

The topic of HelloWord is: based on annual salary, provident fund and income tax calculation monthly net income. (Stateless session bean).

EJB customer view:

Local Customers: Use local interfaces and local primary interfaces. Press the reference transmission value.

Remote customers: Using remote interfaces and remote primary interfaces. Press the variable transmission value. There will be java.rmi.RemoteException errors.

Standard design mode is that all access to the business logic layer use session beans, which require a remote interface to enable the client layer to access these session beans. The remaining entities and stateless session beans can see "implementation details" and only publish local interfaces.

This is the original words in the book, do you understand? Anyway, I can only understand 80%. Haha ~~~ followed.

Developer interface:

inverted! I told a lot of main interfaces before, I remembered it now, I don't know how old this book is written.

The primary interface is responsible for controlling the life cycle operation of Bean: generated, delete, and looking. The primary interface is the first contact point of the customer in the bean. The customer gets references through JNDI. In fact, determine JNDI when deploying, not anxious.

After the customer quotes the primary interface, the bean can be performed by this interface:

l Generate a new instance or look for existing Bean instances. (Local or remote)

l Access the EJBMETADATA interface (remote).

l Sequence references (remote) getting a bean instance.

l Delete the bean instance.

l Execute the primary business method.

In this example, only the primary interface generates a new instance of beans.

The local interface and remote interface are defined in EJB. (Ejbhome and ejblocalhome). The source of these two interfaces is available.

Method in EJBHOME interface:

getjbmetata (): Returns the reference to the EJBMetadata interface to get bean information. (Still don't know what EJBMetadata is something. That dictionary is the meant of metadata). GethomeHandle (): Returns the handle of the main object.

Remove (): Very simple, deleted. Haha, joke, actually different BEAN results, the session bean is putting the bean back into the pool, and the entity bean is deleted from the database. This time is it!

The lower side is the program, I will try the programs to take a moment to talk about it!

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

New Post(0)