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

import it.mice.voila.runtime.entity.Entity;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.event.PostLoadEvent;
import org.hibernate.event.def.DefaultPostLoadEventListener;

/**
 * Created by IntelliJ IDEA.
 * User: zzy9v4
 * Date: 12-feb-2007
 * Time: 16.59.32
 * To change this template use File | Settings | File Templates.
 */
public class PostLoadListener extends DefaultPostLoadEventListener {
    private static Log logger = LogFactory.getLog(PostLoadListener.class);

    public void onPostLoad(PostLoadEvent event) {
        if (event.getEntity() instanceof Entity) {
            ((Entity)event.getEntity()).setInternalEntityStateToLoaded();
        }
        super.onPostLoad(event);
    }
}
