Which Jakarta EE specification defines the programming model for building RESTful web services?
Jakarta REST (formerly JAX-RS) provides annotations and APIs for building RESTful web services in Jakarta EE applications.
Oracle Certification
58 practice questions with correct answers and detailed explanations. Use this guide to review concepts before taking the practice exam.
The Oracle Java Enterprise (1Z0-1095) certification validates professional expertise in Oracle technologies. This study guide covers all 58 practice questions from our 1Z0-1095 practice test, complete with correct answers and explanations to help you understand each concept thoroughly.
Review each question and explanation below, then test yourself with the full interactive practice exam to measure your readiness.
Which Jakarta EE specification defines the programming model for building RESTful web services?
Jakarta REST (formerly JAX-RS) provides annotations and APIs for building RESTful web services in Jakarta EE applications.
In Jakarta Persistence, which annotation is used to mark a class as a managed entity?
@Entity marks a class as a persistent entity that will be mapped to a database table by the JPA provider.
Which of the following best describes the purpose of the EntityManager in Jakarta Persistence?
The EntityManager is the primary interface for managing entity instances and coordinating their lifecycle with the database within a persistence context.
What is the default fetch strategy for a @OneToMany relationship in Jakarta Persistence?
The default fetch strategy for @OneToMany relationships is LAZY, meaning the related collection is loaded only when explicitly accessed.
Which Jakarta Contexts and Dependency Injection scope annotation indicates that a bean instance is created once per application lifetime?
@ApplicationScoped creates a single bean instance that exists for the entire duration of the application and is shared across all users and sessions.
In Jakarta Enterprise Beans, which of the following accurately describes the relationship between a stateful session bean and its conversational state?
Stateful session beans maintain conversational state in instance variables per client session and this state is preserved across method calls until the client reference is removed or the session times out.
Which transaction attribute in Jakarta Enterprise Beans specifies that a method must always run within a transaction, creating a new one if necessary?
REQUIRED (the default) ensures the method executes within a transaction, either using an existing one or creating a new transaction if none exists.
In Jakarta RESTful Web Services, which annotation is used to bind a method parameter to a query string parameter in the URL?
@QueryParam binds method parameters to query string parameters passed in the request URL (e.g., ?param=value).
Which of the following scenarios would require the use of @PersistenceContext(type=PersistenceContextType.EXTENDED) in a Jakarta EE application?
EXTENDED persistence context type keeps the persistence context alive for the entire lifecycle of a stateful session bean, allowing entities to remain managed across multiple method calls.
In Jakarta Batch, which component is responsible for reading items from a data source?
An ItemReader is the batch component that reads data from a source, which is then processed and written by an ItemWriter.
Which Jakarta Messaging API interface represents a connection to a message broker that manages message destinations?
A Connection in Jakarta Messaging represents a client connection to the message broker and is used to create sessions for sending and receiving messages.
In Jakarta Bean Validation, which annotation validates that a string value matches a regular expression pattern?
@Pattern is used to validate that a string matches the specified regular expression pattern using the regex attribute.
Which of the following statements best explains the role of a persistence unit in Jakarta Persistence?
A persistence unit is a logical grouping defined in persistence.xml that includes entity classes and provider configuration for a specific database connection.
In Jakarta Contexts and Dependency Injection, which mechanism allows you to inject different bean implementations based on runtime conditions?
Qualifiers are custom annotations that disambiguate between multiple implementations, and producer methods allow creating bean instances programmatically based on conditions.
Which Jakarta Enterprise Beans transaction attribute ensures that if a transaction already exists, the method runs outside of it in a separate transaction?
REQUIRES_NEW always creates a new transaction for the method invocation, suspending any existing transaction if one is active.
In Jakarta RESTful Web Services, what is the purpose of the @Produces annotation on a resource method?
@Produces specifies the media type(s) (e.g., application/json) that a resource method can return, enabling content negotiation based on client Accept headers.
Which of the following best describes the purpose of named queries in Jakarta Persistence?
Named queries are defined using @NamedQuery annotations and are parsed at startup, allowing for validation and optimization before runtime execution.
In Jakarta Servlet technology, which interface must be implemented to create a filter that can intercept and modify requests and responses?
The Filter interface defines the contract for request/response filters with doFilter(), init(), and destroy() methods for intercepting servlet processing.
Which Jakarta Contexts and Dependency Injection feature allows you to intercept method calls on managed beans to apply cross-cutting concerns?
Interceptors are used to intercept method invocations on managed beans to implement cross-cutting concerns like logging, security, or transaction handling.
In Jakarta Persistence, which mapping annotation establishes a bidirectional one-to-one relationship and indicates which side owns the relationship?
The owning side of a one-to-one relationship uses @JoinColumn, while the non-owning side uses mappedBy to reference the owning side's attribute name.
Which Jakarta Enterprise Beans interceptor annotation is used to invoke a method after the bean method completes but before control returns to the client?
@AroundInvoke defines an interceptor method that wraps the entire bean method execution, allowing control before and after the invocation.
In Jakarta RESTful Web Services, which annotation is used to indicate that a path parameter value should be converted to a specific type like UUID or LocalDate?
@ParamConverter allows you to register custom converters for converting path, query, and header parameter values to application-specific types.
Which of the following statements accurately describes the difference between optimistic and pessimistic locking in Jakarta Persistence?
Optimistic locking detects conflicts after they occur using version fields, while pessimistic locking prevents conflicts by acquiring exclusive locks before modification.
In Jakarta Batch, which artifact is responsible for orchestrating the overall execution flow of a batch job including steps and their sequence?
A Job defines the overall batch processing configuration including the steps to be executed and their orchestration within the batch framework.
Which Jakarta EE specification defines the standard for building RESTful web services?
Jakarta RESTful Web Services (formerly JAX-RS) provides annotations and APIs for building REST endpoints. It is the standard specification for RESTful services in Jakarta EE.
In a Jakarta EE application, what is the primary purpose of the @Transactional annotation?
@Transactional controls whether a method executes within a transaction context and defines rollback behavior. It is essential for ACID compliance in enterprise applications.
Which of the following best describes the role of Jakarta Dependency Injection (CDI)?
CDI provides a standardized dependency injection framework allowing loose coupling between components through annotations like @Inject. It manages bean discovery, scoping, and lifecycle.
What is the default scope for a CDI bean if no scope annotation is specified?
When no explicit scope is declared, a CDI bean defaults to @Dependent scope, meaning it exists only for its injection point and has no shared lifecycle.
In Jakarta Persistence (JPA), which annotation is used to define a one-to-many relationship from the 'one' side?
@OneToMany defines a relationship where one entity can be associated with multiple instances of another entity. It is placed on the collection property on the owning side.
When using Jakarta Persistence, what is the purpose of the @Version annotation?
@Version implements optimistic locking by maintaining a version field that increments on each update, allowing detection of concurrent modifications and preventing lost updates.
Which Jakarta EE API is specifically designed for declarative security in web applications?
Jakarta Security provides simplified APIs for authentication and authorization using standard mechanisms like OpenID Connect and OAuth 2.0, along with declarative security annotations.
In Jakarta Servlet, what does the @WebServlet annotation allow you to do?
@WebServlet is a metadata annotation that allows servlet declaration directly in code, eliminating the need for web.xml configuration entries.
What is the primary difference between @PrePersist and @PostPersist lifecycle callbacks in JPA?
@PrePersist fires before the database INSERT executes, allowing pre-insert logic like timestamp setting. @PostPersist fires after the INSERT succeeds, useful for post-insert operations.
In a REST API using Jakarta REST, how would you specify that a method parameter comes from the request path?
@PathParam binds method parameters to URI template variables defined in the @Path annotation, extracting path segments from the request URL.
Which of the following scenarios would benefit most from using Jakarta Batch?
Jakarta Batch is designed for large-scale batch processing with features like item-oriented processing, chunking, checkpointing, and restart capabilities for fault-tolerant job execution.
In Jakarta EE, what is the purpose of a qualifier annotation in CDI?
Qualifiers allow you to create custom annotations that distinguish between multiple beans of the same type, enabling precise bean selection during injection.
What does the @Stateless annotation indicate in Jakarta Enterprise Beans (EJB)?
@Stateless declares a session bean that doesn't maintain client-specific state, allowing the container to pool and reuse instances across multiple clients for better performance.
In Jakarta Persistence, which query language is used to write database-agnostic queries?
JPQL is an object-oriented query language independent of the underlying database, allowing queries to be written against entity classes rather than raw database tables.
What is the correct sequence of container-managed transaction boundaries for a method marked @Transactional(TxType.REQUIRED)?
REQUIRED ensures a transaction exists before method execution—either using an existing one or creating a new one—and the container manages commit/rollback based on method completion.
Which Jakarta EE specification provides support for asynchronous message-driven processing?
Jakarta Messaging provides asynchronous, loosely-coupled communication between applications through message brokers, supporting both point-to-point and publish-subscribe models.
In a REST service, what HTTP status code should be returned when a POST request successfully creates a new resource?
HTTP 201 Created is the correct response for successful resource creation, typically including a Location header with the URI of the newly created resource.
What is the primary advantage of using CDI events with @Observes over direct method calls in an enterprise application?
Events decouple event producers from observers, allowing dynamic addition of new observers without modifying publisher code, improving maintainability and testability.
In Jakarta Bean Validation, which annotation validates that a string matches a regular expression?
@Pattern constraint validates that a string field matches the provided regular expression pattern, useful for enforcing format requirements like email or phone numbers.
What is the primary purpose of the persistence.xml file in Jakarta Persistence?
persistence.xml is the configuration file for JPA persistence units, specifying the datasource, ORM provider, entity classes, and various provider-specific properties.
When using @Produces in CDI, what does it allow you to do?
@Produces marks a method or field as a producer, allowing the container to inject complex objects—like configurations or API clients—as if they were regular beans.
In Jakarta REST, which annotation is used to specify the media type(s) that a resource produces?
@Produces declares the media types a method can return (e.g., application/json), allowing content negotiation and proper response serialization based on client preferences.
What is the key difference between @Stateful and @Stateless session beans in EJB?
@Stateful beans maintain client-specific state across multiple invocations, while @Stateless beans are stateless and pooled, making them more scalable for high-throughput scenarios.
In a Jakarta Persistence query using JPQL, what is the purpose of the FETCH JOIN clause?
FETCH JOIN eagerly loads related entities in one query round-trip, preventing the N+1 query problem that occurs when lazy-loading relationships in loops.
You are designing a Java EE application that requires transaction management across multiple databases. Which annotation should you use to declaratively manage transaction boundaries in an EJB session bean?
The @TransactionAttribute annotation is the standard EJB declarative transaction management mechanism that controls transaction propagation behavior. While @Transactional exists in Spring, the exam focuses on Java EE standards.
When using JPA in a container-managed environment, what is the scope of a transaction-scoped persistence context?
A transaction-scoped persistence context is automatically created when a transaction begins and is closed when it ends, ensuring entities are managed only during the active transaction. This is the default and most common persistence context scope in Java EE.
You need to implement security in a Java EE application where certain business methods should only be accessible to users with the 'ADMIN' role. Which approach is BEST for declarative method-level security?
@RolesAllowed is the standard Java EE annotation for declarative method-level authorization that allows you to specify which roles can invoke a protected method. This provides clean, maintainable security without hardcoding authorization logic.
In a JPA entity relationship, you have defined a OneToMany association with cascade=CascadeType.ALL. What happens when you delete a parent entity that has active child entities?
CascadeType.ALL includes CascadeType.REMOVE, which means delete operations on the parent are cascaded to all associated child entities. This automatically removes child records when the parent is deleted.
You are implementing message-driven bean (MDB) processing for an application. The onMessage() method throws an unchecked exception. What is the default behavior?
When an exception is thrown in an MDB's onMessage() method, the container-managed transaction is rolled back and the message is typically returned to the queue for redelivery based on the messaging provider's retry configuration.
Which of the following statements about servlet filters is correct?
Filters can prevent propagation through the chain by not invoking chain.doFilter(), allowing them to send a response or redirect directly. This is commonly used for authentication, logging, and request validation before reaching the servlet.
In a clustered Java EE environment, you need to ensure session replication across cluster nodes. Which session persistence mechanism is MOST appropriate for high-availability requirements?
Database-backed or shared persistent storage enables session replication across cluster nodes, ensuring sessions survive node failures. This is the standard approach for high-availability clustering in Java EE environments.
When using JPQL, what is the primary difference between the JOIN and JOIN FETCH keywords in a query?
JOIN FETCH explicitly loads associated entities in the same query to populate the object graph, preventing lazy loading exceptions later. Regular JOIN only filters results but doesn't guarantee the related entities are loaded into the persistence context.
You are configuring a WebSocket endpoint in a Java EE application. Which annotation indicates that a class should be treated as a WebSocket server endpoint?
@ServerEndpoint is the standard Java EE (JSR 356) annotation that marks a class as a WebSocket server endpoint and requires specifying the URI path where clients can connect.
In a Java EE application using bean validation (JSR 380), you have applied multiple custom validators to a single field. How are multiple validation constraint violations handled?
Bean Validation collects ALL constraint violations across all validators applied to a field and returns them in a Set<ConstraintViolation<T>>, allowing comprehensive validation error reporting rather than fail-fast behavior.
You've reviewed all 58 questions. Take the interactive practice exam to simulate the real test environment.
▶ Start Practice Exam — Free