Which statement is correct ?

  1. Session.contains() method to determine if an instance belongs to the session cache.

  2. Session.contains() method to determine if an instance belongs to the data base

  3. Both are correct

  4. None of the above


Correct Option: A
Explanation:

To solve this question, the user needs to have knowledge about the Session object in Hibernate.

The Session.contains() method is used to check if a particular object is associated with the current Hibernate session or not.

Option A is correct because the Session.contains() method is used to determine if an instance belongs to the session cache.

Option B is incorrect because the Session.contains() method does not determine if an instance belongs to the database. Instead, it checks whether the instance is associated with the current Hibernate session or not.

Option C is incorrect because only option A is correct.

Option D is incorrect because option A is the correct answer.

Therefore,

The Answer is: A.

Find more quizzes: