09 EJB Spring Flashcards

(12 cards)

1
Q

What is a Java EE Application Server?”

A

A software product that implements the Java EE specification to provide services like multithreading; transactions; security; and persistence.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain the difference between Explicit and Implicit Middleware.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the three types of Session Beans in EJB?

A

Stateless (no client-specific state); Stateful (routed to the same instance for one client); and Singleton (one instance for all clients).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the purpose of the Container Generated Wrapper Class in EJB?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the default transaction behavior for EJBs?

A

Container Managed Transaction (CMT) with the ‘REQUIRED’ attribute is the default; meaning every EJB method is transactional unless specified otherwise.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the two types of transaction management in Spring?

A

Programmatic (manual start/stop via API; rarely used) and Declarative (controlled at the method level via @Transactional annotations).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the primary goal of Dependency Injection (DI) in Spring?

A

To decouple objects from the implementation classes of their dependencies; allowing for easier testing with mock objects and environment-dependent configuration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain the Spring Boot ‘Spring-boot-starter-data-jpa’ feature.

A

It allows for automatic default JPA configuration based on the classpath; often requiring only a single JNDI name in a properties file to function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is ‘Spring Data’ and how does it help developers?

A

A module that generates database access implementations at runtime based on Repository interfaces; eliminating the need to write standard CRUD code manually.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does Spring Data generate queries automatically?

A

It parses the names of methods added to a repository interface (e.g.; ‘findByLastname’) and generates the corresponding SQL/JPQL at startup.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the default rollback behavior for the @Transactional annotation in Spring?

A

It performs a rollback for RuntimeException and its subclasses; but not for checked exceptions unless configured via ‘rollbackFor’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain the REQUIRES_NEW transaction attribute in EJB/Spring.

A

It suspends any existing transaction (T1) and starts a completely new; independent transaction (T2). The success or failure of T2 does not affect T1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly