/** * Add anonymous parameters, specifying only their SQL types * as defined in the {@code java.sql.Types} class. * <p>Parameter ordering is significant. This method is an alternative * to the {@link #declareParameter} method, which should normally be preferred. * @param types array of SQL types as defined in the * {@code java.sql.Types} class * @throws InvalidDataAccessApiUsageException if the operation is already compiled */ public void setTypes(@Nullable int[] types) throws InvalidDataAccessApiUsageException { if (isCompiled()) { throw new InvalidDataAccessApiUsageException("Cannot add parameters once query is compiled"); } if (types != null) { for (int type : types) { declareParameter(new SqlParameter(type)); } } }
/** * Add anonymous parameters, specifying only their SQL types * as defined in the {@code java.sql.Types} class. * <p>Parameter ordering is significant. This method is an alternative * to the {@link #declareParameter} method, which should normally be preferred. * @param types array of SQL types as defined in the * {@code java.sql.Types} class * @throws InvalidDataAccessApiUsageException if the operation is already compiled */ public void setTypes(@Nullable int[] types) throws InvalidDataAccessApiUsageException { if (isCompiled()) { throw new InvalidDataAccessApiUsageException("Cannot add parameters once query is compiled"); } if (types != null) { for (int type : types) { declareParameter(new SqlParameter(type)); } } }
/** * Add anonymous parameters, specifying only their SQL types * as defined in the {@code java.sql.Types} class. * <p>Parameter ordering is significant. This method is an alternative * to the {@link #declareParameter} method, which should normally be preferred. * @param types array of SQL types as defined in the * {@code java.sql.Types} class * @throws InvalidDataAccessApiUsageException if the operation is already compiled */ public void setTypes(int[] types) throws InvalidDataAccessApiUsageException { if (isCompiled()) { throw new InvalidDataAccessApiUsageException("Cannot add parameters once query is compiled"); } if (types != null) { for (int type : types) { declareParameter(new SqlParameter(type)); } } }