Languages-Java [3i Infotech Placement]: Sample Questions 82 - 83 of 141

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 82

Appeared in Year: 2004

Question

MCQ▾

What happens if Database Updation code is written in ejb Passivate () method and if this method is called?

Choices

Choice (4)

a.

Successfully executes the Database Updation code

b.

Compilation error occurs indicating that Database Updation code should not be written in ejbPassivate ()

c.

Ejb Store () method is called

d.

Exception is thrown

Answer

c.

Explanation

  • Ejb Passivate method is called when it is necessary to synchronize the bean data with the database.
  • This will most likely trigger an UPDATE to occur.
  • The ejb Store is triggered when the bean is no longer being used by a client and the container decides to move the ready instance back into the pooled state. nullejbLoad method: ejb Store method:
  • Database Updation code is written in ejb Passivate () method and this method is called in ejb Store () .
    • Vendor implementations may differ slightly as to when the ejb Store () method is called, but this is not the bean developer՚s concern.
    • The ejb Store () method will be called after one or more business methods have been invoked or at the end of a transaction.

Question 83

Edit

Write in Short

Short Answer▾

Can we declare variable inside a method as final variables? Why?

Explanation

No, method variables cannot be final as such a variable is initialized once for each method scope which is not allowed for final variables.

Developed by: