EntityReload()
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
editRefreshes 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
edituser = 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
- ORM
- ORM - Sessions and Transactions
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)