/** * @since 1.1 */ public ProcedureQuery(String procedureName, Class<?> resultType) { setRoot(procedureName); this.resultClass = resultType; }
/** * @since 1.1 */ public ProcedureQuery(Procedure procedure, Class<?> resultType) { setRoot(procedure); this.resultClass = resultType; }
/** * Creates a ProcedureQuery based on a Procedure object. */ public ProcedureQuery(Procedure procedure) { // for backwards compatibility we go against usual default... metaData.setFetchingDataRows(true); setRoot(procedure); }
/** * @since 1.1 */ public ProcedureQuery(Procedure procedure, Class resultType) { setRoot(procedure); this.resultClass = resultType; // call this for backwards compatibility setResultClassName(resultType != null ? resultType.getName() : null); }
/** * Creates a ProcedureQuery based on a Procedure object. The query would fetch * DataRows. Fetching Persistent objects can be achieved either by using * {@link #ProcedureQuery(String, Class)} constructor or by calling * {@link #setFetchingDataRows(boolean)} and {@link #setResultEntityName(String)} * methods. */ public ProcedureQuery(Procedure procedure) { // for backwards compatibility we go against usual default... metaData.setFetchingDataRows(true); setRoot(procedure); }
/** * Creates a ProcedureQuery based on a stored procedure. The query would fetch * DataRows. Fetching Persistent objects can be achieved either by using * {@link #ProcedureQuery(String, Class)} constructor or by calling * {@link #setFetchingDataRows(boolean)} and {@link #setResultEntityName(String)} * methods. * * @param procedureName A name of the stored procedure. For this query to work, a * procedure with this name must be mapped in Cayenne. */ public ProcedureQuery(String procedureName) { // for backwards compatibility we go against usual default... metaData.setFetchingDataRows(true); setRoot(procedureName); }
/** * <p> * Performance Note: with current EntityResolver implementation it is preferrable to * use Procedure object instead of String as a query root. String root can cause * unneeded EntityResolver reindexing on every call. See this mailing list thread: <a * href="http://objectstyle.org/cayenne/lists/cayenne-user/2005/01/0109.html"> * http://objectstyle.org/cayenne/lists/cayenne-user/2005/01/0109.html</a> * </p> * * @since 1.1 */ public ProcedureQuery(String procedureName, Class resultType) { setRoot(procedureName); this.resultClass = resultType; setResultClassName(resultType != null ? resultType.getName() : null); }
/** * Creates a ProcedureQuery based on a stored procedure. * <p> * Performance Note: with current EntityResolver implementation it is preferrable to * use Procedure object instead of String as a query root. String root can cause * unneeded EntityResolver reindexing on every call. See this mailing list thread: <a * href="http://objectstyle.org/cayenne/lists/cayenne-user/2005/01/0109.html"> * http://objectstyle.org/cayenne/lists/cayenne-user/2005/01/0109.html</a> * </p> * * @param procedureName A name of the stored procedure. For this query to work, a * procedure with this name must be mapped in Cayenne. */ public ProcedureQuery(String procedureName) { // for backwards compatibility we go against usual default... metaData.setFetchingDataRows(true); setRoot(procedureName); }
/** * Creates and returns a new ProcedureQuery built using this query as a prototype and * substituting template parameters with the values from the map. * * @since 1.1 */ public Query createQuery(Map<String, ?> parameters) { // create a query replica ProcedureQuery query = new ProcedureQuery(); if (root != null) { query.setRoot(root); } query.setResultEntityName(resultEntityName); query.metaData.copyFromInfo(this.metaData); query.setParameters(parameters); // TODO: implement algorithm for building the name based on the original name and // the hashcode of the map of parameters. This way query clone can take advantage // of caching. return query; }
/** * Returns a ProcedureQuery. */ public Query getQuery() { ProcedureQuery query = new ProcedureQuery(); Object root = getRoot(); if (root != null) { query.setRoot(root); } query.setName(name); query.setResultEntityName(resultEntity); query.initWithProperties(properties); return query; }
/** * Creates and returns a new ProcedureQuery built using this query as a prototype and * substituting template parameters with the values from the map. * * @since 1.1 */ public Query createQuery(Map parameters) { // create a query replica ProcedureQuery query = new ProcedureQuery(); if (root != null) { query.setRoot(root); } query.setResultClassName(resultClassName); query.setResultEntityName(resultEntityName); query.metaData.copyFromInfo(this.metaData); query.setParameters(parameters); // TODO: implement algorithm for building the name based on the original name and // the hashcode of the map of parameters. This way query clone can take advantage // of caching. return query; }
@Override public ProcedureQuery buildQuery() { ProcedureQuery procedureQuery = new ProcedureQuery(); if (root != null) { procedureQuery.setRoot(root); } procedureQuery.setName(this.getName()); procedureQuery.setDataMap(dataMap); procedureQuery.setResultEntityName(this.getResultEntityName()); procedureQuery.initWithProperties(this.getProperties()); return procedureQuery; }