@SuppressWarnings("unchecked")
  public List<ReportDataSource> getDataSources() throws ProviderException {
    String fromClause =
        "from org.efs.openreports.objects.ReportDataSource reportDataSource order by reportDataSource.name ";

    return (List<ReportDataSource>) hibernateProvider.query(fromClause);
  }
  public ReportDataSource getDataSource(String name) throws ProviderException {
    Session session = null;

    try {
      session = hibernateProvider.openSession();

      Criteria criteria = session.createCriteria(ReportDataSource.class);
      criteria.add(Restrictions.eq("name", name));

      return (ReportDataSource) criteria.uniqueResult();
    } catch (HibernateException he) {
      throw new ProviderException(he);
    } finally {
      hibernateProvider.closeSession(session);
    }
  }
 public void deleteReportParameter(ReportParameter reportParameter) throws ProviderException {
   try {
     hibernateProvider.delete(reportParameter);
   } catch (ConstraintException ce) {
     throw new ProviderException(LocalStrings.ERROR_PARAMETER_DELETION);
   }
 }
  @SuppressWarnings("unchecked")
  public List<ReportParameter> getReportParameters() throws ProviderException {
    String fromClause =
        "from org.efs.openreports.objects.ReportParameter reportParameter order by reportParameter.name ";

    return (List<ReportParameter>) hibernateProvider.query(fromClause);
  }
 public void deleteDataSource(ReportDataSource dataSource) throws ProviderException {
   try {
     hibernateProvider.delete(dataSource);
     dataSources.remove(dataSource.getId());
   } catch (ConstraintException ce) {
     throw new ProviderException(LocalStrings.ERROR_DATASOURCE_DELETION);
   }
 }
  public ReportDataSource insertDataSource(ReportDataSource dataSource) throws ProviderException {
    testDataSource(dataSource);

    dataSource = (ReportDataSource) hibernateProvider.save(dataSource);
    dataSources.put(dataSource.getId(), dataSource);

    return dataSource;
  }
 public ReportDataSource getDataSource(Integer id) throws ProviderException {
   return (ReportDataSource) hibernateProvider.load(ReportDataSource.class, id);
 }
  public void updateDataSource(ReportDataSource dataSource) throws ProviderException {
    testDataSource(dataSource);

    hibernateProvider.update(dataSource);
    dataSources.put(dataSource.getId(), dataSource);
  }
 public void updateReportParameter(ReportParameter reportParameter) throws ProviderException {
   hibernateProvider.update(reportParameter);
 }
 public ReportParameter insertReportParameter(ReportParameter reportParameter)
     throws ProviderException {
   return (ReportParameter) hibernateProvider.save(reportParameter);
 }
 public ReportParameter getReportParameter(Integer id) throws ProviderException {
   return (ReportParameter) hibernateProvider.load(ReportParameter.class, id);
 }