Java 类org.hibernate.event.PostUpdateEventListener 实例源码

项目:cacheonix-core    文件:EntityUpdateAction.java   
private void postUpdate() {
    PostUpdateEventListener[] postListeners = getSession().getListeners()
            .getPostUpdateEventListeners();
    if (postListeners.length>0) {
        PostUpdateEvent postEvent = new PostUpdateEvent( 
                getInstance(), 
                getId(), 
                state, 
                previousState, 
                getPersister(),
                (EventSource) getSession() 
            );
        for ( int i = 0; i < postListeners.length; i++ ) {
            postListeners[i].onPostUpdate(postEvent);
        }
    }
}
项目:cacheonix-core    文件:EntityUpdateAction.java   
private void postCommitUpdate() {
    PostUpdateEventListener[] postListeners = getSession().getListeners()
            .getPostCommitUpdateEventListeners();
    if (postListeners.length>0) {
        PostUpdateEvent postEvent = new PostUpdateEvent( 
                getInstance(), 
                getId(), 
                state, 
                previousState, 
                getPersister(),
                (EventSource) getSession()
            );
        for ( int i = 0; i < postListeners.length; i++ ) {
            postListeners[i].onPostUpdate(postEvent);
        }
    }
}
项目:Lucee4    文件:HibernateORMEngine.java   
private static void addEventListeners(PageContext pc, SessionFactoryData data, Key key) throws PageException {
    if(!data.getORMConfiguration().eventHandling()) return;
    String eventHandler = data.getORMConfiguration().eventHandler();
    AllEventListener listener=null;
    if(!Util.isEmpty(eventHandler,true)){
        //try {
            Component c = pc.loadComponent(eventHandler.trim());

            listener = new AllEventListener(c);
            //config.setInterceptor(listener);
        //}catch (PageException e) {e.printStackTrace();}
    }
    Configuration conf = data.getConfiguration(key);
    conf.setInterceptor(new InterceptorImpl(listener));
       EventListeners listeners = conf.getEventListeners();
       Map<String, CFCInfo> cfcs = data.getCFCs(key);
       // post delete
    List<EventListener> 
    list=merge(listener,cfcs,CommonUtil.POST_DELETE);
    listeners.setPostDeleteEventListeners(list.toArray(new PostDeleteEventListener[list.size()]));

       // post insert
    list=merge(listener,cfcs,CommonUtil.POST_INSERT);
    listeners.setPostInsertEventListeners(list.toArray(new PostInsertEventListener[list.size()]));

    // post update
    list=merge(listener,cfcs,CommonUtil.POST_UPDATE);
    listeners.setPostUpdateEventListeners(list.toArray(new PostUpdateEventListener[list.size()]));

    // post load
    list=merge(listener,cfcs,CommonUtil.POST_LOAD);
    listeners.setPostLoadEventListeners(list.toArray(new PostLoadEventListener[list.size()]));

    // pre delete
    list=merge(listener,cfcs,CommonUtil.PRE_DELETE);
    listeners.setPreDeleteEventListeners(list.toArray(new PreDeleteEventListener[list.size()]));

    // pre insert
    //list=merge(listener,cfcs,CommonUtil.PRE_INSERT);
    //listeners.setPreInsertEventListeners(list.toArray(new PreInsertEventListener[list.size()]));

    // pre load
    list=merge(listener,cfcs,CommonUtil.PRE_LOAD);
    listeners.setPreLoadEventListeners(list.toArray(new PreLoadEventListener[list.size()]));

    // pre update
    //list=merge(listener,cfcs,CommonUtil.PRE_UPDATE);
    //listeners.setPreUpdateEventListeners(list.toArray(new PreUpdateEventListener[list.size()]));
}