Multiple choice technology programming languages

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

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Session.contains() checks if a specific entity instance is currently managed within the persistence context (session cache). It does not query the database to determine if the record exists there. Therefore, the first statement is correct, while the second is incorrect because it misinterprets the method's scope.