1. Understanding EJBS

Source: Internet
Author: User

What is EJB?
1. Enterprice JavaBeans (EJB) is a standard server-side component model for distributed business applications. 2. Applications written with the EJB architecture are extensible, transactional, and user-safe. 3. Applications written in EJB can be deployed on servers such as JBoss, WebLogic, and so on (Tomcat is just a web container and does not contain an EJB container)4. EJB is used to write MVC's business layer (Model) code 5. EJB provides many services that need to be used in enterprise development, such as transaction management, security, persistence, and distribution. Because these services are provided by containers, we do not need to develop them ourselves. 6. The difference between EJB and spring, EJB is used to do distributed system. Spring is a better choice if the project does not require a distributed deployment

Deploy the public business to a single server. This allows different services to access the same business, enabling maximum reuse at the component level

introduce the commonly used annotations:
* javax.ejb.Stateless *indicates that this class is a stateless session bean*managing beans With instance pool technology* * @Stateless (name="ABC") *indicates that the Jndi name for this class is ABC*do not specify a simple name for this class by default* ****************************
* *javax.ejb.Stateful*indicates that this class is a stateful bean*save their information for each user*using the activation management bean*session information is persisted from memory to disk for passivation (serialization)*restore from disk to memory active (deserialization)*if it expires, it will automatically erase the information on the disk.* ***************************
* *Javax.ejb.Remote*indicates that it is a remote interface*do not write default is local interface (locally)
*********************************
* * javax.ejb.Local
* *Local Interface* *****************************
* * When EJBS and clients run concurrently within a JVM, the local interface is preferred
*
*Javax.ejb.EJB
* Automatic injection of other EJB properties, similar to spring's org.springframework.beans.factory.annotation.Autowired
**********************************
*@Resource(mappedname= "Java:jndi's name") DataSource da;
* Inject Other resources
*
*


1. Understanding EJBS

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.