Example usage for org.hibernate.event.spi AbstractPreDatabaseOperationEvent getSource

List of usage examples for org.hibernate.event.spi AbstractPreDatabaseOperationEvent getSource

Introduction

In this page you can find the example usage for org.hibernate.event.spi AbstractPreDatabaseOperationEvent getSource.

Prototype

@Deprecated
public EventSource getSource() 

Source Link

Document

Getter for property 'source'.

Usage

From source file:org.grails.orm.hibernate.support.ClosureEventListener.java

License:Apache License

protected void synchronizeEntityUpdateActionState(AbstractPreDatabaseOperationEvent event, Object entity,
        HashMap<Integer, Object> changedState) {
    if (actionQueueUpdatesField != null && event instanceof PreInsertEvent && changedState.size() > 0) {
        try {/*from  w  w  w .ja  v  a 2 s .  c o m*/
            ExecutableList<EntityUpdateAction> updates = (ExecutableList<EntityUpdateAction>) actionQueueUpdatesField
                    .get(event.getSource().getActionQueue());
            if (updates != null) {
                for (EntityUpdateAction updateAction : updates) {
                    if (updateAction.getInstance() == entity) {
                        Object[] updateState = (Object[]) entityUpdateActionStateField.get(updateAction);
                        if (updateState != null) {
                            for (Map.Entry<Integer, Object> entry : changedState.entrySet()) {
                                updateState[entry.getKey()] = entry.getValue();
                            }
                        }
                    }
                }
            }
        } catch (Exception e) {
            LOG.warn("Exception in synchronizeEntityUpdateActionState", e);
        }
    }
}