Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LoadEventHandler
interface LoadEventHandler {
/**
* Perform the load
*/
Object load(
String entityName,
Object id,
LockMode lockMode,
LoadType loadType,
SessionImplementor session);
}
interface PostLoadEventListener {
void postLoad(
Object loadedInstance,
String entityName,
Object id,
LockMode lockMode,
LoadType loadType,
SessionImplementor session);
}
interface PreLoadEventListener {
void preLoad(
String entityName,
Object id,
LockMode lockMode,
LoadType loadType,
SessionImplementor session);
}
class StandardLoadEventHandler implements LoadEventHandler {
...
List<PreLoadEventListener> preEventListeners = ...;
List<PostLoadEventListener> postEventListeners = ...;
@Override
public Object load(
String entityName,
Object id,
LockMode lockMode,
LoadType loadType,
SessionImplementor session) {
notifyPreEventListeners( ... );
final Object result = ...;
notifyPostEventListeners( result, ... );
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.