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

项目:cacheonix-core    文件:EntityInsertAction.java   
private void postInsert() {
    PostInsertEventListener[] postListeners = getSession().getListeners()
            .getPostInsertEventListeners();
    if ( postListeners.length > 0 ) {
        PostInsertEvent postEvent = new PostInsertEvent(
                getInstance(),
                getId(),
                state,
                getPersister(),
                (EventSource) getSession()
        );
        for ( int i = 0; i < postListeners.length; i++ ) {
            postListeners[i].onPostInsert(postEvent);
        }
    }
}
项目:cacheonix-core    文件:EntityInsertAction.java   
private void postCommitInsert() {
    PostInsertEventListener[] postListeners = getSession().getListeners()
            .getPostCommitInsertEventListeners();
    if ( postListeners.length > 0 ) {
        PostInsertEvent postEvent = new PostInsertEvent(
                getInstance(),
                getId(),
                state,
                getPersister(),
                (EventSource) getSession() 
        );
        for ( int i = 0; i < postListeners.length; i++ ) {
            postListeners[i].onPostInsert(postEvent);
        }
    }
}
项目:cacheonix-core    文件:EntityIdentityInsertAction.java   
private void postInsert() {
    if ( isDelayed ) {
        getSession().getPersistenceContext().replaceDelayedEntityIdentityInsertKeys( delayedEntityKey, generatedId );
    }
    PostInsertEventListener[] postListeners = getSession().getListeners()
            .getPostInsertEventListeners();
    if (postListeners.length>0) {
        PostInsertEvent postEvent = new PostInsertEvent(
                getInstance(),
                generatedId,
                state,
                getPersister(),
                (EventSource) getSession()
        );
        for ( int i = 0; i < postListeners.length; i++ ) {
            postListeners[i].onPostInsert(postEvent);
        }
    }
}
项目:cacheonix-core    文件:EntityIdentityInsertAction.java   
private void postCommitInsert() {
    PostInsertEventListener[] postListeners = getSession().getListeners()
            .getPostCommitInsertEventListeners();
    if (postListeners.length>0) {
        PostInsertEvent postEvent = new PostInsertEvent(
                getInstance(),
                generatedId,
                state,
                getPersister(),
                (EventSource) getSession() 
        );
        for ( int i = 0; i < postListeners.length; i++ ) {
            postListeners[i].onPostInsert(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()]));
}