/** * In this JDBC implementation a job id is obtained by asking the * jobIncrementer (which is likely a sequence) for the next long value, and * then passing the Id and parameter values into an INSERT statement. * * @see JobInstanceDao#createJobInstance(String, JobParameters) * @throws IllegalArgumentException * if any {@link JobParameters} fields are null. */ @Override public JobInstance createJobInstance(String jobName, JobParameters jobParameters) { Assert.notNull(jobName, "Job name must not be null."); Assert.notNull(jobParameters, "JobParameters must not be null."); Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist"); Long jobId = jobIncrementer.nextLongValue(); JobInstance jobInstance = new JobInstance(jobId, jobName); jobInstance.incrementVersion(); Object[] parameters = new Object[] { jobId, jobName, jobKeyGenerator.generateKey(jobParameters), jobInstance.getVersion() }; getJdbcTemplate().update( getQuery(CREATE_JOB_INSTANCE), parameters, new int[] { Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER }); return jobInstance; }
/** * In this JDBC implementation a job id is obtained by asking the * jobIncrementer (which is likely a sequence) for the next long value, and * then passing the Id and parameter values into an INSERT statement. * * @see JobInstanceDao#createJobInstance(String, JobParameters) * @throws IllegalArgumentException * if any {@link JobParameters} fields are null. */ @Override public JobInstance createJobInstance(String jobName, JobParameters jobParameters) { Assert.notNull(jobName, "Job name must not be null."); Assert.notNull(jobParameters, "JobParameters must not be null."); Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist"); Long jobId = jobIncrementer.nextLongValue(); JobInstance jobInstance = new JobInstance(jobId, jobName); jobInstance.incrementVersion(); Object[] parameters = new Object[] { jobId, jobName, jobKeyGenerator.generateKey(jobParameters), jobInstance.getVersion() }; getJdbcTemplate().update( getQuery(CREATE_JOB_INSTANCE), parameters, new int[] { Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER }); return jobInstance; }
/** * In this JDBC implementation a job id is obtained by asking the * jobIncrementer (which is likely a sequence) for the next long value, and * then passing the Id and parameter values into an INSERT statement. * * @see JobInstanceDao#createJobInstance(String, JobParameters) * @throws IllegalArgumentException * if any {@link JobParameters} fields are null. */ @Override public JobInstance createJobInstance(String jobName, JobParameters jobParameters) { Assert.notNull(jobName, "Job name must not be null."); Assert.notNull(jobParameters, "JobParameters must not be null."); Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist"); Long jobId = jobIncrementer.nextLongValue(); JobInstance jobInstance = new JobInstance(jobId, jobName); jobInstance.incrementVersion(); Object[] parameters = new Object[] { jobId, jobName, jobKeyGenerator.generateKey(jobParameters), jobInstance.getVersion() }; getJdbcTemplate().update( getQuery(CREATE_JOB_INSTANCE), parameters, new int[] { Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER }); return jobInstance; }
/** * In this JDBC implementation a job id is obtained by asking the * jobIncrementer (which is likely a sequence) for the next long value, and * then passing the Id and parameter values into an INSERT statement. * * @see JobInstanceDao#createJobInstance(String, JobParameters) * @throws IllegalArgumentException * if any {@link JobParameters} fields are null. */ @Override public JobInstance createJobInstance(String jobName, JobParameters jobParameters) { Assert.notNull(jobName, "Job name must not be null."); Assert.notNull(jobParameters, "JobParameters must not be null."); Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist"); Long jobId = jobIncrementer.nextLongValue(); JobInstance jobInstance = new JobInstance(jobId, jobName); jobInstance.incrementVersion(); Object[] parameters = new Object[] { jobId, jobName, jobKeyGenerator.generateKey(jobParameters), jobInstance.getVersion() }; getJdbcTemplate().update( getQuery(CREATE_JOB_INSTANCE), parameters, new int[] { Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER }); return jobInstance; }
/** * In this jdbc implementation a job id is obtained by asking the * jobIncrementer (which is likely a sequence) for the next long value, and * then passing the Id and parameter values into an INSERT statement. * * @see JobInstanceDao#createJobInstance(String, JobParameters) * @throws IllegalArgumentException * if any {@link JobParameters} fields are null. */ public JobInstance createJobInstance(String jobName, JobParameters jobParameters) { Assert.notNull(jobName, "Job name must not be null."); Assert.notNull(jobParameters, "JobParameters must not be null."); Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist"); Long jobId = jobIncrementer.nextLongValue(); JobInstance jobInstance = new JobInstance(jobId, jobParameters, jobName); jobInstance.incrementVersion(); Object[] parameters = new Object[] { jobId, jobName, createJobKey(jobParameters), jobInstance.getVersion() }; getJdbcTemplate().getJdbcOperations().update( getQuery(CREATE_JOB_INSTANCE), parameters, new int[] { Types.BIGINT, Types.VARCHAR, Types.VARCHAR, Types.INTEGER }); insertJobParameters(jobId, jobParameters); return jobInstance; }