All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.jasperreports.hibernate.JRHibernateQueryExecuterFactory Maven / Gradle / Ivy

The newest version!
/*
 * JasperReports - Free Java Reporting Library.
 * Copyright (C) 2001 - 2023 Cloud Software Group, Inc. All rights reserved.
 * http://www.jaspersoft.com
 *
 * Unless you have purchased a commercial license agreement from Jaspersoft,
 * the following license terms apply:
 *
 * This program is part of JasperReports.
 *
 * JasperReports is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JasperReports 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with JasperReports. If not, see .
 */
package net.sf.jasperreports.hibernate;

import java.util.Map;

import net.sf.jasperreports.engine.JRDataset;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRValueParameter;
import net.sf.jasperreports.engine.JasperReportsContext;
import net.sf.jasperreports.engine.query.AbstractQueryExecuterFactory;
import net.sf.jasperreports.engine.query.HibernateConstants;
import net.sf.jasperreports.engine.query.JRQueryExecuter;
import net.sf.jasperreports.engine.util.Designated;

/**
 * Query executer factory for HQL queries that uses Hibernate 3.
 * 

* The factory creates {@link net.sf.jasperreports.hibernate.JRHibernateQueryExecuter JRHibernateQueryExecuter} * query executers. * * @author Lucian Chirita ([email protected]) */ public class JRHibernateQueryExecuterFactory extends AbstractQueryExecuterFactory implements Designated { public final static Object[] HIBERNATE_BUILTIN_PARAMETERS = { //passing the parameter type as class name and not class in order to //avoid a dependency on Hibernate classes so that reports that have //HQL queries would load even when Hibernate is not present HibernateConstants.PARAMETER_HIBERNATE_SESSION, "org.hibernate.Session", }; /** * Returns an array containing the {@link HibernateConstants#PARAMETER_HIBERNATE_SESSION PARAMETER_HIBERNATE_SESSION} * parameter. */ @Override public Object[] getBuiltinParameters() { return HIBERNATE_BUILTIN_PARAMETERS; } @Override public JRQueryExecuter createQueryExecuter( JasperReportsContext jasperReportsContext, JRDataset dataset, Map parameters ) throws JRException { return new JRHibernateQueryExecuter(jasperReportsContext, dataset, parameters); } /** * Returns true for all parameter types. */ @Override public boolean supportsQueryParameterType(String className) { return true; } @Override public String getDesignation() { return HibernateConstants.QUERY_EXECUTER_NAME_HQL; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy