nerdexam
Oracle

1Z0-895 · Question #25

A developer wants to release resources within a stateless session bean class. The cleanup method should be executed by the container before an instance of the class is removed. The deployment…

The correct answer is B. The cleanup method must have no arguments and return void. C. The cleanup method is executed in an unspecified transaction and security context. D. The developer should mark the cleanup method with the @PreDestroy annotation. See the full explanation below for the reasoning.

Question

A developer wants to release resources within a stateless session bean class. The cleanup method should be executed by the container before an instance of the class is removed. The deployment descriptor is NOT used. Which three statements are correct? (Choose three.)

Options

  • AThe cleanup method may declare checked exceptions.
  • BThe cleanup method must have no arguments and return void.
  • CThe cleanup method is executed in an unspecified transaction and security context.
  • DThe developer should mark the cleanup method with the @PreDestroy annotation.
  • EThe developer should mark the cleanup method with the @PostDestroy annotation.
  • FThe cleanup method is executed in the transaction and security context of the last business method

How the community answered

(40 responses)
  • A
    13% (5)
  • B
    75% (30)
  • E
    8% (3)
  • F
    5% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-895 Practice