package it.mice.voila.runtime.hibernate.listeners;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.event.spi.PostInsertEvent;
import org.hibernate.event.spi.PostInsertEventListener;
import org.hibernate.event.spi.PostUpdateEvent;
import org.hibernate.event.spi.PostUpdateEventListener;
import org.hibernate.persister.entity.EntityPersister;

/**
 * Created by IntelliJ IDEA.
 * User: zzy9v4
 * Date: 12-feb-2007
 * Time: 16.59.32
 * To change this template use File | Settings | File Templates.
 * @deprecated since rel 3.0.1
 */
public class PostUpdateListener implements PostUpdateEventListener, PostInsertEventListener {
    private static Log logger = LogFactory.getLog(PostUpdateListener.class);

    public void onPostUpdate(PostUpdateEvent event) {
//      Now the loaded status is set during the postFlush operation to ensure that the status is changed
//    	only if the operation success.
    	
//      if (event.getEntity() instanceof Entity) {
//            Entity entity = (Entity)event.getEntity();
//            if (entity.isChangedEntity()) {
//                entity.setInternalEntityStateToLoaded();
//            }
//        }
    }

    public void onPostInsert(PostInsertEvent event) {
//      Now the loaded status is set during the postFlush operation to ensure that the status is changed
//    	only if the operation success.

//      if (event.getEntity() instanceof Entity) {
//            Entity entity = (Entity)event.getEntity();
//            if (entity.isNewEntity()) {
//                entity.setInternalEntityStateToLoaded();
//            }
//        }
    }
    
	@Override
	public boolean requiresPostCommitHanding(EntityPersister persister) {
		// TODO Auto-generated method stub
		return false;
	}
}
