import java.io.Serializable;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.iman.dao.base.BaseDao;
public class BaseDaoImpl extends HibernateDaoSupport implements BaseDao{
public boolean save(Object obj) throws Exception{
try {
this.getHibernateTemplate().save(obj);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean update(Object obj) throws Exception{
try {
this.getHibernateTemplate().update(obj);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean saveOrUpdate(Object obj) throws Exception{
try {
this.getHibernateTemplate().saveOrUpdate(obj);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean saveOrUpdateAll(List<?> list) throws Exception{
try {
this.getHibernateTemplate().saveOrUpdateAll(list);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public Object get(Class<?> className, Serializable id)throws Exception{
return getHibernateTemplate().get(className, id);
}
public boolean delete(Object object) throws Exception{
try {
this.getHibernateTemplate().delete(object);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean deleteAll(List<?> ls) throws Exception{
try {
this.getHibernateTemplate().deleteAll(ls);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}