Skip to content

Jakarta


my-jakarta-project/
├── pom.xml                         # Maven configuration file, containing dependencies and build instructions
├── src
│   ├── main
│   │   ├── java
│   │   │   └── com
│   │   │       └── example
│   │   │           ├── controller
│   │   │           │   └── PhysicianResource.java   # REST controller
│   │   │           ├── model
│   │   │           │   └── Physician.java           # JPA entity class
│   │   │           ├── service
│   │   │           │   └── PhysicianService.java    # Business service class
│   │   │           ├── repository
│   │   │           │   └── PhysicianRepository.java # Database access class
│   │   │           └── cdi
│   │   │               └── AppProducer.java         # CDI producer class for injecting beans
│   │   ├── resources
│   │   │   ├── META-INF
│   │   │   │   └── persistence.xml                  # JPA persistence configuration file
│   │   │   ├── application.properties               # Application configuration file
│   │   │   └── logback.xml                          # Logging configuration file
│   │   ├── webapp
│   │       ├── WEB-INF
│   │       │   ├── web.xml                          # Web application configuration file
│   │       │   └── beans.xml                        # CDI configuration file
│   │       ├── index.jsp                            # Web application homepage (JSP)
│   │       └── static
│   │           ├── js                               # Directory for JavaScript files
│   │           └── css                              # Directory for CSS files
│   └── test
│       ├── java
│       │   └── com
│       │       └── example
│       │           └── PhysicianResourceTest.java   # REST service test

Java / Jakarta EE Architecture

akarta EE Architecture

Java Naming and Directory Interface(JNDI)

CDI:

Payara

Presentation Layer

  • Model:
  • VIEW:
  • CONTROLLER:

Java Servlets

Servlet

run in a container

  • life cycle methods of a servelt

    • init() -> service() -> destory()

JSP

JSTL

Jakarta EE Presentation Technologies

Annotations

  1. RESTful Services (JAX-RS) Annotations
    • @Path: Defines the relative path for a resource class or method.
    • @GET: Indicates that a method responds to HTTP GET requests.
    • @POST: Indicates that a method responds to HTTP POST requests.
    • @Produces: Defines the media types that the methods of a resource can produce.
    • @Consumes: Defines the media types that the methods of a resource can accept.
    • @PathParam: Binds a method parameter to a URI path segment.
  2. JPA (Java Persistence API) Annotations
    1. @Entity: Specifies that a class is an entity and is mapped to a database table.
    2. @Table: Specifies the table in the database that the entity is mapped to.
    3. @Id: Specifies the primary key of an entity.
    4. @GeneratedValue: Specifies the generation strategy for the values of primary keys.
    5. @Column: Specifies the mapped column for a persistent property or field.
    6. @OneToMany, @ManyToOne, @OneToOne, @ManyToMany: Define relationships between entities.
  3. CDI (Contexts and Dependency Injection) Annotations

    1. • @Inject: Specifies that a dependency should be injected.
    2. • @Named: Defines a name for a CDI bean, which can be used in EL (Expression Language) in JSP or JSF.
    3. • @Produces: Used to create producer methods, which are used to inject custom objects.
    4. • @RequestScoped, @SessionScoped, @ApplicationScoped: Define the scope of a CDI bean.
  4. EJB (Enterprise JavaBeans) Annotations

    1. @Stateless: Defines a stateless session bean, which does not maintain a conversational state with clients.
    2. @Stateful: Defines a stateful session bean, which maintains a state with the client across multiple method calls.
    3. @Singleton: Defines a singleton session bean, which maintains a single instance throughout the application.
    4. @Schedule: Defines a timer method for scheduling tasks.
    5. @Asynchronous: Specifies that a method should be invoked asynchronously.
  5. Jakarta Security Annotations
  6. @RolesAllowed: Specifies that only users with certain roles can access the annotated method or class.
  7. @RolesAllowed("ADMIN")
  8. @PermitAll: Allows access to everyone.
  9. • @DenyAll: Denies access to everyone.
  10. JSF
    1. JSF Life Cycle
  11. Maven
  12. JPA Hibernate MyBatis Comparison

---