agave-apps/apps-core/src/main/java/org/iplantc/service/apps/dao/SoftwareDao.java
/** Delete the old software record and add the new software record in one transaction. */
Delete the old software record and add the new software record in one transaction.
Delete the old software record and add the new software record in one transaction .
public static void replace(Software oldSoftware, Software newSoftware) throws SoftwareException
    {
        if (oldSoftware == null)
            throw new SoftwareException("Existing Software cannot be null");
        if (newSoftware == null)
            throw new SoftwareException("New Software cannot be null");
        try
        {
            Session session = getSession();
            session.clear();
            session.disableFilter("softwareTenantFilter");
            session.delete(oldSoftware);
            session.flush();
            session.saveOrUpdate(newSoftware);
            session.flush();
        }
        catch (HibernateException ex)
        {
            try
            {
                if (HibernateUtil.getSession().isOpen())
                {
                    HibernateUtil.rollbackTransaction();
                }
            }
            catch (Exception ignored)
            {
            }
            throw new SoftwareException("Failed to replace application", ex);
        }
        finally
        {
            try { HibernateUtil.commitTransaction(); } catch (Exception ignored) {}
        }
    }
public static void replace ( Software oldSoftware , Software newSoftware ) throws SoftwareException { if ( oldSoftware == null ) throw new SoftwareException ( "Existing Software cannot be null" ) ; if ( newSoftware == null ) throw new SoftwareException ( "New Software cannot be null" ) ; try { Session session = getSession ( ) ; session . clear ( ) ; session . disableFilter ( "softwareTenantFilter" ) ; session . delete ( oldSoftware ) ; session . flush ( ) ; session . saveOrUpdate ( newSoftware ) ; session . flush ( ) ; } catch ( HibernateException ex ) { try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception ignored ) { } throw new SoftwareException ( "Failed to replace application" , ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Delete the old software record and add the new software record in one transaction.
Delete the old software record and add the new software record in one transaction .