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

In Hibernate, the session.contains() method checks whether a given instance is present in the first-level cache (session cache), not whether it exists in the database. To check database existence, you would use a query or get() method. The statement correctly identifies this.