agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/dao/JobDao.java
/**
     * Saves or updates a job, optionally forcing the lastUpdated timestamp to update.
     *
     * @param job the job to save
     * @param forceTimestamp true if a timestamp should be set, false otherwise
     * @throws JobException if unable to save the job
     */
Saves or updates a job, optionally forcing the lastUpdated timestamp to update.
@param job the job to save
@param forceTimestamp true if a timestamp should be set, false otherwise
@throws JobException if unable to save the job
Saves or updates a job optionally forcing the lastUpdated timestamp to update . @param job the job to save @param forceTimestamp true if a timestamp should be set false otherwise @throws JobException if unable to save the job
public static void persist(Job job, boolean forceTimestamp) 
	throws JobException, StaleStateException
	{
		if (job == null)
			throw new JobException("Job cannot be null");
		Session session = null;
		try
		{
			session = getSession();
			if (forceTimestamp) {
				job.setLastUpdated(new DateTime().toDate());
			}
			session.saveOrUpdate(job);
        } catch (StaleStateException ex) {
            throw ex;
        } catch (HibernateException ex) {
            log.error("Concurrency issue experienced updating job " + job.getUuid() + " aborting save.");
            try {
                if (session != null && session.isOpen()) {
                    HibernateUtil.rollbackTransaction();
                    session.close();
                }
            } catch (Exception ignored) {
            }
            throw new JobException(ex);
        } finally {
            try {
                HibernateUtil.commitTransaction();
            } catch (Exception ignored) {
            }
        }
	}
public static void persist ( Job job , boolean forceTimestamp ) throws JobException , StaleStateException { if ( job == null ) throw new JobException ( "Job cannot be null" ) ; Session session = null ; try { session = getSession ( ) ; if ( forceTimestamp ) { job . setLastUpdated ( new DateTime ( ) . toDate ( ) ) ; } session . saveOrUpdate ( job ) ; } catch ( StaleStateException ex ) { throw ex ; } catch ( HibernateException ex ) { log . error ( "Concurrency issue experienced updating job " + job . getUuid ( ) + " aborting save." ) ; try { if ( session != null && session . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; session . close ( ) ; } } catch ( Exception ignored ) { } throw new JobException ( ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Saves or updates a job, optionally forcing the lastUpdated timestamp to update.
Saves or updates a job optionally forcing the lastUpdated timestamp to update .
// TODO: swallow this and rethrow a JobException for consistent behavior and easier exception handling upstream