/*
 * Created on 27-09-2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package net.sf.hibern8ide;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import net.sf.hibernate.type.Type;

/**
 * @author MAX
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public abstract class AbstractQueryPage implements QueryPage {

    private boolean released;
    private int id;
    final protected Session session;
    protected List list;
    List pathNames;
    protected boolean sticky;
    protected List exceptions = new ArrayList();

    /**
     * @param session2
     */
    public AbstractQueryPage(Session session2) {
        this.session = session2;

    }

    /**
     * @param i
     */
    public void setId(int i) {
    	id = i;
    
    }

    /**
     * 
     */
    public List getExceptions() {
    	return exceptions;
    }

    public void release() {
    	if (!released && session.isOpen()) {
    		try {
    			session.close();
    		} catch (HibernateException e) {
    			exceptions.add(e);
    		}
    		released = true;
    	}
    
    }

    /**
     * @return
     */
    public int getID() {
        return id;
    }

    /**
     * @return
     */
    public boolean isSticky() {
        return sticky;
    }

    /**
     * @param sticky
     */
    public void setSticky(boolean sticky) {
        this.sticky = sticky;
    }

}
