Simplify developers' views
If you use an existing version of EJB, you will understand how difficult it is to develop a simple EJB program such as HelloWorld. You need at least two interfaces, one bean class and one deployment description file. Most developers want to know why I need all of this. IDEs (development environment tools), such as Oracle's JDeveloper, Eclipse, and XDoclet, simplify the developer's development cycle, but before you deploy EJB in the selected container, compiling classes and packaging deployment files are still the work of developers.
EJB3.0 tries to simplify complexity in the following ways:
· You do not need to define interfaces and deployment description files. These files can be generated by containers using metadata annotations.
· Use common Java classes as EJB classes and common EJB business interfaces.
Metadata Annotations)
EJB3.0 relies heavily on Metadata Annotations. Metadata Annotations has become the JSR 175 standard and will be part of J2SE 5.0. Annotations is an object-converted attribute, which is very similar to XDoclet. However, unlike XDoclet, which requires pre-compilation, Annotations is compiled by the Java compiler. (Dependent on the start time of @ Retention ). In the developer's opinion, Annotations is like a public modifier that can be used as classes, domains, methods, parameters, local variables, constructs, enumerations, and packages. You can use Annotations with special attributes in your Java code to generate code, write document code automatically, or provide special services such as enhancing business layer security or special business logic during running. J2EE1.5 (5.0) aims to simplify the use of Annotations by developers and thus may generate a set of Annotations templates. Annotations are marked with @ as follows:
@ Author ("Debu Panda ")
@ Bean
Public class MySessionBean
To simplify development, EJB3.0 uses Metadata Annotations to generate many human factors like interfaces and uses Annotations to replace deployment description files.
Use POJOs and POJIs
In the standard conditions, JavaBeans and interfaces often involve simple Java objects (POJOs) and simple Java interfaces (POJIs) respectively ). These unnecessary Home interface human factors have been removed.
Developers must implement an ejb interface (session bean, Entity bean or message-driven bean) in the javax. EJB package or use Annotation in the bean implementation class. You can use stateless, state, message-driven, or entity to annotate a bean class. For example, if you define a stateless EJB as HelloWorld, you can define EJB as follows:
@ Remote
@ Stateless public class HelloWorldBean {
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.