What is bean-managed persistence?

  1. When you implement entity or session bean methods to use SQL commands you provide.

  2. When the bean's container handles data storage and retrieval.

  3. When the J2EE server is never shut down

  4. When changes to database data are lost during a crash.


Correct Option: A

AI Explanation

To answer this question, we need to understand the concept of bean-managed persistence in J2EE (Java 2 Enterprise Edition).

Bean-managed persistence refers to the approach where the developer explicitly implements entity or session bean methods to handle the storage and retrieval of data using SQL commands. In this approach, the responsibility of managing the data storage and retrieval is placed on the developer, rather than the bean's container.

Let's go through each option to understand why it is correct or incorrect:

Option A) When you implement entity or session bean methods to use SQL commands you provide - This option is correct because it accurately describes bean-managed persistence. In this approach, the developer is responsible for implementing the necessary SQL commands to handle data storage and retrieval.

Option B) When the bean's container handles data storage and retrieval - This option is incorrect. In bean-managed persistence, the container does not handle data storage and retrieval. It is the developer's responsibility to implement the necessary logic for handling data using SQL commands.

Option C) When the J2EE server is never shut down - This option is incorrect. Bean-managed persistence is not dependent on the J2EE server being continuously running. It is a design approach for handling data storage and retrieval within the J2EE application.

Option D) When changes to database data are lost during a crash - This option is incorrect. Bean-managed persistence does not necessarily imply that changes to database data will be lost during a crash. The data handling and persistence strategy can be implemented in a way that ensures data integrity and recovery.

Therefore, the correct answer is A) When you implement entity or session bean methods to use SQL commands you provide. This option accurately describes the concept of bean-managed persistence, where the developer is responsible for implementing the necessary SQL commands to handle data storage and retrieval.

Find more quizzes: