1 28 package net.sf.jasperreports.engine.query; 29 30 import java.util.Map ; 31 32 import net.sf.jasperreports.engine.JRDataset; 33 import net.sf.jasperreports.engine.JRException; 34 import net.sf.jasperreports.engine.util.JRProperties; 35 36 import org.hibernate.Session; 37 38 47 public class JRHibernateQueryExecuterFactory implements JRQueryExecuterFactory 48 { 49 50 53 public static final String QUERY_LANGUAGE_HQL = "hql"; 54 55 58 public final static String PARAMETER_HIBERNATE_SESSION = "HIBERNATE_SESSION"; 59 60 65 public final static String PARAMETER_HIBERNATE_FILTER_COLLECTION = "HIBERNATE_FILTER_COLLECTION"; 66 67 private final static Object [] HIBERNATE_BUILTIN_PARAMETERS = { 68 PARAMETER_HIBERNATE_SESSION, Session.class, 69 PARAMETER_HIBERNATE_FILTER_COLLECTION, Object .class, 70 }; 71 72 82 public static final String PROPERTY_HIBERNATE_QUERY_RUN_TYPE = JRProperties.PROPERTY_PREFIX + "hql.query.run.type"; 83 84 91 public static final String PROPERTY_HIBERNATE_QUERY_LIST_PAGE_SIZE = JRProperties.PROPERTY_PREFIX + "hql.query.list.page.size"; 92 93 97 public static final String PROPERTY_HIBERNATE_FIELD_MAPPING_DESCRIPTIONS = JRProperties.PROPERTY_PREFIX + "hql.field.mapping.descriptions"; 98 99 103 public static final String VALUE_HIBERNATE_QUERY_RUN_TYPE_LIST = "list"; 104 105 109 public static final String VALUE_HIBERNATE_QUERY_RUN_TYPE_ITERATE = "iterate"; 110 111 115 public static final String VALUE_HIBERNATE_QUERY_RUN_TYPE_SCROLL = "scroll"; 116 117 118 122 public Object [] getBuiltinParameters() 123 { 124 return HIBERNATE_BUILTIN_PARAMETERS; 125 } 126 127 public JRQueryExecuter createQueryExecuter(JRDataset dataset, Map parameters) throws JRException 128 { 129 return new JRHibernateQueryExecuter(dataset, parameters); 130 } 131 132 135 public boolean supportsQueryParameterType(String className) 136 { 137 return true; 138 } 139 } 140 | Popular Tags |