What is a Java EE Application Server?”
A software product that implements the Java EE specification to provide services like multithreading; transactions; security; and persistence.
Explain the difference between Explicit and Implicit Middleware.
Explicit middleware requires manual calls to services like security or transactions in the source code; whereas Implicit middleware uses configuration files or annotations to trigger these services automatically via a request broker or wrapper.
What are the three types of Session Beans in EJB?
Stateless (no client-specific state); Stateful (routed to the same instance for one client); and Singleton (one instance for all clients).
What is the purpose of the Container Generated Wrapper Class in EJB?
It implements the business interface; intercepts client calls to provide middleware services (like starting a transaction); and then delegates the call to the actual bean implementation.
What is the default transaction behavior for EJBs?
Container Managed Transaction (CMT) with the ‘REQUIRED’ attribute is the default; meaning every EJB method is transactional unless specified otherwise.
What are the two types of transaction management in Spring?
Programmatic (manual start/stop via API; rarely used) and Declarative (controlled at the method level via @Transactional annotations).
What is the primary goal of Dependency Injection (DI) in Spring?
To decouple objects from the implementation classes of their dependencies; allowing for easier testing with mock objects and environment-dependent configuration.
Explain the Spring Boot ‘Spring-boot-starter-data-jpa’ feature.
It allows for automatic default JPA configuration based on the classpath; often requiring only a single JNDI name in a properties file to function.
What is ‘Spring Data’ and how does it help developers?
A module that generates database access implementations at runtime based on Repository interfaces; eliminating the need to write standard CRUD code manually.
How does Spring Data generate queries automatically?
It parses the names of methods added to a repository interface (e.g.; ‘findByLastname’) and generates the corresponding SQL/JPQL at startup.
What is the default rollback behavior for the @Transactional annotation in Spring?
It performs a rollback for RuntimeException and its subclasses; but not for checked exceptions unless configured via ‘rollbackFor’.
Explain the REQUIRES_NEW transaction attribute in EJB/Spring.
It suspends any existing transaction (T1) and starts a completely new; independent transaction (T2). The success or failure of T2 does not affect T1.