/* Copyright (C) 2005 supergloo, inc. http://www.supergloo.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.udcpension.data.base; import net.sf.hibernate.Criteria; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Session; import org.springframework.dao.DataAccessException; import org.springframework.orm.hibernate.HibernateTemplate; /** * Based on Hibernate Synchronizer * For more information or documentation, visit The Hibernate Synchronizer page * at http://www.binamics.com/hibernatesync or contact Joe Hudson at joe@binamics.com. * * @author Joe Hudson * @author Todd McGrath */ public abstract class SpringBaseRootDAO extends HibernateTemplate { /** * Return the name of the configuration file to be used with this DAO or null if default */ public String getConfigurationFileName () { return null; } /** * Return the specific Object class that will be used for class-specific * implementation of this DAO. * @return the reference Class */ protected abstract Class getReferenceClass(); /** * Return a Criteria object that relates to the DAO's table */ protected Criteria createCriteria (Session s) throws DataAccessException { return s.createCriteria(getReferenceClass()); } /** * Return a Criteria object that relates to the DAO's table */ public Criteria createCriteria () throws HibernateException { Session s = getSessionFactory().openSession(); return s.createCriteria(getReferenceClass()); } /** * Return the property of the class you would like to use for default ordering * @return the property name */ public String getDefaultOrderProperty () { return null; } }