Multiple choice technology programming languages

Difference between Emp e = session.load(Emp.class) and Emp e = session.createCriteria(Emp.class) ?

  1. On session close session.load() Emp Object unavailable to access.

  2. On session close session.createCriteria() Emp unavailable to access.

  3. None

  4. a & b

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

session.load() can return a proxy and may not hit the database until you access the object's properties. If the session is closed before accessing properties, you cannot load the data (throws LazyInitializationException). session.createCriteria() immediately executes the query and returns fully initialized objects that remain accessible after session closes.