EntityReload()

edit

Reloads data for an entity that is already loaded.

Requires Extension: Hibernate ORM Engine Extension

EntityReload( entity=object );

Returns: void

Argument Description
entity
object, required
edit

name of the entity

Usage Notes

edit

Refreshes the entity from the database, discarding any in-memory changes. The entity must be persistent (in the current session).

Useful when you suspect the database has been modified by another process or raw SQL and you want the latest state.

Examples

edit
user = entityLoadByPK( "User", 42 );
user.setName( "Temporary change" );
// Discard in-memory change, reload from database
entityReload( user );
// user.getName() is back to the database value

See also