Multiple choice technology web technology

It is possible to re-load an object and all its collections at any time, using the xxxx() method. This is useful when database triggers are used to initialize some of the properties of the object.What is the xxxx() method ?

  1. refresh();

  2. flush();

  3. fetch();

  4. load()

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

Session.refresh() re-loads the entity and its collections from the database, overwriting current state. This is useful when database triggers or other external processes modify data. flush() syncs to DB, load() may return a proxy, and fetch() doesn't exist.

AI explanation

The refresh() method reloads an object's state, including its collections, directly from the database, which is exactly what's needed when database triggers modify property values behind the scenes after a save. flush() instead pushes pending in-memory changes to the database (the opposite direction), and fetch()/load() aren't the ORM methods used for this specific re-synchronization purpose.