Jakarta EE
Template:Short description Template:Infobox software platform Template:Java platforms Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE<ref>Template:Cite web</ref> with specifications for enterprise features such as distributed computing and web services.<ref>Template:Cite web</ref> Jakarta EE applications are run on reference runtimes, which can be microservices or application servers, which handle transactions, security, scalability, concurrency and management of the components they are deploying.
Jakarta EE is defined by its specification. The specification defines APIs (application programming interface) and their interactions. As with other Java Community Process specifications, providers must meet certain conformance requirements in order to declare their products as Jakarta EE compliant.
Examples of contexts in which Jakarta EE referencing runtimes are used are: e-commerce, accounting, banking information systems.
History
[edit]The platform created by Sun Microsystems was known as Java 2 Platform, Enterprise Edition or J2EE from version 1.2, until the name was changed to Java Platform, Enterprise Edition or Java EE in version 1.5.
After Sun was acquired in 2009, Java EE was maintained by Oracle under the Java Community Process. On September 12, 2017, Oracle Corporation announced that it would submit Java EE to the Eclipse Foundation.<ref>Template:Cite web</ref> The Eclipse top-level project has been named Eclipse Enterprise for Java (EE4J).<ref>Template:Cite web</ref> The Eclipse Foundation could not agree with Oracle over the use of Template:Code and Java trademarks.<ref>Template:Cite web</ref> Oracle owns the trademark for the name "Java" and the platform was renamed from Java EE to Jakarta EE.<ref>Template:Cite news</ref><ref>Template:Cite news</ref> The name refers to the largest city on the island of Java and also the capital of Indonesia, Jakarta.<ref>Template:Cite web</ref> The name should not be confused with the former Jakarta Project which fostered a number of current and former Java projects at the Apache Software Foundation.
Platform version | Release<ref>Template:Cite web</ref> | Specification | Template:Nowrap Support | Important Changes |
---|---|---|---|---|
Jakarta EE 11 | Planned for June/July 2024 | 11 | Java SE 21 | Data |
Jakarta EE 10 | Template:Nowrap<ref>Template:Cite press release</ref> | 10 | Template:Ubl | Removal of deprecated items in Servlet, Faces, CDI and EJB (Entity Beans and Embeddable Container). CDI-Build Time. |
Template:Nowrap | Template:Nowrap<ref>Template:Cite press release</ref> | 9.1 | Template:Ubl | JDK 11 support |
Jakarta EE 9 | Template:Nowrap<ref>Template:Cite press release</ref> | 9 | Java SE 8 | API namespace move from Template:Code to Template:Code |
Jakarta EE 8 | Template:Nowrap<ref>Template:Cite press release</ref> | 8 | Java SE 8 | Full compatibility with Java EE 8 |
Java EE 8 | 2017-08-31 | JSR 366 | Java SE 8 | HTTP/2 and CDI based Security |
Java EE 7 | 2013-05-28 | JSR 342 | Java SE 7 | WebSocket, JSON and HTML5 support |
Java EE 6 | 2009-12-10 | JSR 316 | Java SE 6 | CDI managed Beans and REST |
Java EE 5 | 2006-05-11 | JSR 244 | Java SE 5 | Java annotations and Generics in Java |
J2EE 1.4 | 2003-11-11 | JSR 151 | J2SE 1.4 | WS-I interoperable web services<ref>Template:Cite web</ref> |
J2EE 1.3 | 2001-09-24 | JSR 58 | J2SE 1.3 | Java connector architecture<ref>Template:Cite web</ref> |
J2EE 1.2 | 1999-12-17 | 1.2 | J2SE 1.2 | Initial specification release |
Specifications
[edit]Jakarta EE includes several specifications that serve different purposes, like generating web pages, reading and writing from a database in a transactional way, managing distributed queues.
The Jakarta EE APIs include several technologies that extend the functionality of the base Java SE APIs, such as Jakarta Enterprise Beans, connectors, servlets, Jakarta Server Pages and several web service technologies.
Web specifications
[edit]- Jakarta Servlet: defines how to manage HTTP requests, in a synchronous or asynchronous way. It is low level and other Jakarta EE specifications rely on it;
- Jakarta WebSocket: API specification that defines a set of APIs to service WebSocket connections;
- Jakarta Faces: a technology for constructing user interfaces out of components;
- Jakarta Expression Language (EL) is a simple language originally designed to satisfy the specific needs of web application developers. It is used specifically in Jakarta Faces to bind components to (backing) beans and in Contexts and Dependency Injection to named beans, but can be used throughout the entire platform.
Web service specifications
[edit]- Jakarta RESTful Web Services provides support in creating web services according to the Representational State Transfer (REST) architectural pattern;
- Jakarta JSON Processing is a set of specifications to manage information encoded in JSON format;
- Jakarta JSON Binding provides specifications to convert JSON information into or from Java classes;
- Jakarta XML Binding allows mapping XML into Java objects;
- Jakarta XML Web Services can be used to create SOAP web services.
Enterprise specifications
[edit]- Jakarta Activation (JAF) specifies an architecture to extend component Beans by providing data typing and bindings of such types.
- Jakarta Contexts and Dependency Injection (CDI) is a specification to provide a dependency injection container;
- Jakarta Enterprise Beans (EJB) specification defines a set of lightweight APIs that an object container (the EJB container) will support in order to provide transactions (using JTA), remote procedure calls (using RMI or RMI-IIOP), concurrency control, dependency injection and access control for business objects. This package contains the Jakarta Enterprise Beans classes and interfaces that define the contracts between the enterprise bean and its clients and between the enterprise bean and the ejb container.
- Jakarta Persistence (JPA) are specifications about object-relational mapping between relation database tables and Java classes.
- Jakarta Transactions (JTA) contains the interfaces and annotations to interact with the transaction support offered by Jakarta EE. Even though this API abstracts from the really low-level details, the interfaces are also considered somewhat low-level and the average application developer in Jakarta EE is either assumed to be relying on transparent handling of transactions by the higher level EJB abstractions, or using the annotations provided by this API in combination with CDI managed beans.
- Jakarta Messaging (JMS) provides a common way for Java programs to create, send, receive and read an enterprise messaging system's messages.
Other specifications
[edit]- Jakarta Validation: This package contains the annotations and interfaces for the declarative validation support offered by the Jakarta Validation API. Jakarta Validation provides a unified way to provide constraints on beans (e.g. Jakarta Persistence model classes) that can be enforced cross-layer. In Jakarta EE, Jakarta Persistence honors bean validation constraints in the persistence layer, while JSF does so in the view layer.
- Jakarta Batch provides the means for batch processing in applications to run long running background tasks that possibly involve a large volume of data and which may need to be periodically executed.
- Jakarta Connectors is a Java-based tool for connecting application servers and enterprise information systems (EIS) as part of enterprise application integration (EAI). This is a low-level API aimed at vendors that the average application developer typically does not come in contact with.
Web profile
[edit]In an attempt to limit the footprint of web containers, both in physical and in conceptual terms, the web profile was created, a subset of the Jakarta EE specifications. The Jakarta EE web profile comprises the following:
Certified referencing runtimes
[edit]Although by definition all Jakarta EE implementations provide the same base level of technologies (namely, the Jakarta EE spec and the associated APIs), they can differ considerably with respect to extra features (like connectors, clustering, fault tolerance, high availability, security, etc.), installed size, memory footprint, startup time, etc.
Jakarta EE
[edit]Java EE
[edit]Code sample
[edit]The code sample shown below demonstrates how various technologies in Java EE 7 are used together to build a web form for editing a user.
In Jakarta EE a (web) UI can be built using Jakarta Servlet, Jakarta Server Pages (JSP), or Jakarta Faces (JSF) with Facelets. The example below uses Faces and Facelets. Not explicitly shown is that the input components use the Jakarta EE Bean Validation API under the covers to validate constraints.
<syntaxhighlight lang="xml"> <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:metadata> <f:viewParam name="user_id" value="#{userEdit.user}" converter="#{userConvertor}" /> </f:metadata>
<h:body>
<h:messages />
<h:form> <h:panelGrid columns="2"> <h:outputLabel for="firstName" value="First name" /> <h:inputText id="firstName" value="#{userEdit.user.firstName}" label="First name" />
<h:outputLabel for="lastName" value="Last name" /> <h:inputText id="lastName" value="#{userEdit.user.lastName}" label="Last name" />
<h:commandButton action="#{userEdit.saveUser}" value="Save" /> </h:panelGrid> </h:form>
</h:body>
</html> </syntaxhighlight>
Example Backing Bean class
[edit]To assist the view, Jakarta EE uses a concept called a "Backing Bean". The example below uses Contexts and Dependency Injection (CDI) and Jakarta Enterprise Beans (EJB).
<syntaxhighlight lang="java"> @Named @ViewScoped public class UserEdit {
private User user;
@Inject private UserDAO userDAO;
public String saveUser() { userDAO.save(this.user); addFlashMessage("User " + this.user.getId() + " saved");
return "users.xhtml?faces-redirect=true"; }
public void setUser(User user) { this.user = user; }
public User getUser() { return user; }
} </syntaxhighlight>
Example Data Access Object class
[edit]To implement business logic, Jakarta Enterprise Beans (EJB) is the dedicated technology in Jakarta EE. For the actual persistence, JDBC or Jakarta Persistence (JPA) can be used. The example below uses EJB and JPA. Not explicitly shown is that JTA is used under the covers by EJB to control transactional behavior.
<syntaxhighlight lang="java"> @Stateless public class UserDAO {
@PersistenceContext private EntityManager entityManager;
public void save(User user) { entityManager.persist(user); }
public void update(User user) { entityManager.merge(user); }
public List<User> getAll() { return entityManager.createNamedQuery("User.getAll", User.class) .getResultList(); }
} </syntaxhighlight>
Example Entity class
[edit]For defining entity/model classes Jakarta EE provides the Jakarta Persistence (JPA), and for expressing constraints on those entities it provides the Bean Validation API. The example below uses both these technologies.
<syntaxhighlight lang="java"> @Entity public class User {
@Id @GeneratedValue(strategy = IDENTITY) private Integer id;
@Size(min = 2, message="First name too short") private String firstName;
@Size(min = 2, message="Last name too short") private String lastName;
public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
public String getFirstName() { return firstName; }
public void setFirstName(String firstName) { this.firstName = firstName; }
public String getLastName() { return lastName; }
public void setLastName(String lastName) { this.lastName = lastName; }
} </syntaxhighlight>
See also
[edit]- Canigó (framework)
- Deployment descriptor
- Java BluePrints
- Java Research License
- Sun Community Source License
- Sun Java System Portal Server
- Web container
- J2ME
References
[edit]External links
[edit]- Template:Official website
- The Official Jakarta EE Tutorial
- First Cup of Jakarta EE Tutorial: An Introduction to Jakarta EE
- Jakarta EE Specification Guide - Jakarta EE Platform
- Jakarta EE Official Starter: Generate a Jakarta EE Project
- Java Platform, Enterprise Edition (Java EE), Oracle Technology Network
- Jakarta EE official YouTube channel
Template:Jakarta EE Template:Eclipse Foundation Template:Java (software platform)