Search in sources :

Example 11 with InsertHashtable

use of cbit.sql.InsertHashtable in project vcell by virtualcell.

the class DBTopLevel method updateVersionable.

/**
 * This method was created in VisualAge.
 * @return cbit.sql.Versionable
 * @param object cbit.sql.Versionable
 * @param name java.lang.String
 * @param bVersion boolean
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.sql.SQLException The exception description.
 * @exception cbit.sql.RecordChangedException The exception description.
 */
KeyValue updateVersionable(User user, Model model, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = modelDB.updateVersionable(new InsertHashtable(), con, user, model, bVersion);
        con.commit();
        return versionKey;
    } catch (Throwable e) {
        lg.error(e.getMessage(), e);
        try {
            con.rollback();
        } catch (Throwable rbe) {
            // rbe.printStackTrace(System.out);
            lg.error("exception during rollback, bEnableRetry = " + bEnableRetry);
        }
        if (bEnableRetry && isBadConnection(con)) {
            conFactory.failed(con, lock);
            return updateVersionable(user, model, bVersion, false);
        } else {
            handle_DataAccessException_SQLException(e);
            // never gets here;
            return null;
        }
    } finally {
        conFactory.release(con, lock);
    }
}
Also used : InsertHashtable(cbit.sql.InsertHashtable) KeyValue(org.vcell.util.document.KeyValue) Connection(java.sql.Connection)

Example 12 with InsertHashtable

use of cbit.sql.InsertHashtable in project vcell by virtualcell.

the class DBTopLevel method insertVersionable.

/**
 * This method was created in VisualAge.
 * @return cbit.sql.Versionable
 * @param object cbit.sql.Versionable
 * @param name java.lang.String
 * @param bVersion boolean
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.sql.SQLException The exception description.
 * @exception cbit.sql.RecordChangedException The exception description.
 */
KeyValue insertVersionable(User user, BioModelMetaData bioModelMetaData, BioModelChildSummary bmcs, String name, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = bioModelDB.insertVersionable(new InsertHashtable(), con, user, bioModelMetaData, bmcs, name, bVersion);
        con.commit();
        return versionKey;
    } catch (Throwable e) {
        lg.error(e.getMessage(), e);
        try {
            con.rollback();
        } catch (Throwable rbe) {
            // rbe.printStackTrace(System.out);
            lg.error("exception during rollback, bEnableRetry = " + bEnableRetry);
        }
        if (bEnableRetry && isBadConnection(con)) {
            conFactory.failed(con, lock);
            return insertVersionable(user, bioModelMetaData, bmcs, name, bVersion, false);
        } else {
            handle_DataAccessException_SQLException(e);
            // never gets here;
            return null;
        }
    } finally {
        conFactory.release(con, lock);
    }
}
Also used : InsertHashtable(cbit.sql.InsertHashtable) KeyValue(org.vcell.util.document.KeyValue) Connection(java.sql.Connection)

Example 13 with InsertHashtable

use of cbit.sql.InsertHashtable in project vcell by virtualcell.

the class DBTopLevel method updateVersionable.

/**
 * This method was created in VisualAge.
 * @return cbit.sql.Versionable
 * @param object cbit.sql.Versionable
 * @param name java.lang.String
 * @param bVersion boolean
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.sql.SQLException The exception description.
 * @exception cbit.sql.RecordChangedException The exception description.
 */
KeyValue updateVersionable(User user, BioModelMetaData bioModelMetaData, BioModelChildSummary bmcs, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = bioModelDB.updateVersionable(new InsertHashtable(), con, user, bioModelMetaData, bmcs, bVersion);
        con.commit();
        return versionKey;
    } catch (Throwable e) {
        lg.error(e.getMessage(), e);
        try {
            con.rollback();
        } catch (Throwable rbe) {
            // rbe.printStackTrace(System.out);
            lg.error("exception during rollback, bEnableRetry = " + bEnableRetry);
        }
        if (bEnableRetry && isBadConnection(con)) {
            conFactory.failed(con, lock);
            return updateVersionable(user, bioModelMetaData, bmcs, bVersion, false);
        } else {
            handle_DataAccessException_SQLException(e);
            // never gets here;
            return null;
        }
    } finally {
        conFactory.release(con, lock);
    }
}
Also used : InsertHashtable(cbit.sql.InsertHashtable) KeyValue(org.vcell.util.document.KeyValue) Connection(java.sql.Connection)

Example 14 with InsertHashtable

use of cbit.sql.InsertHashtable in project vcell by virtualcell.

the class DBTopLevel method updateVersionable.

/**
 * This method was created in VisualAge.
 * @return cbit.sql.Versionable
 * @param object cbit.sql.Versionable
 * @param name java.lang.String
 * @param bVersion boolean
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.sql.SQLException The exception description.
 * @exception cbit.sql.RecordChangedException The exception description.
 */
KeyValue updateVersionable(User user, MathModelMetaData mathModelMetaData, MathModelChildSummary mmcs, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = mathModelDB.updateVersionable(new InsertHashtable(), con, user, mathModelMetaData, mmcs, bVersion);
        con.commit();
        return versionKey;
    } catch (Throwable e) {
        lg.error(e.getMessage(), e);
        try {
            con.rollback();
        } catch (Throwable rbe) {
            // rbe.printStackTrace(System.out);
            lg.error("exception during rollback, bEnableRetry = " + bEnableRetry);
        }
        if (bEnableRetry && isBadConnection(con)) {
            conFactory.failed(con, lock);
            return updateVersionable(user, mathModelMetaData, mmcs, bVersion, false);
        } else {
            handle_DataAccessException_SQLException(e);
            // never gets here;
            return null;
        }
    } finally {
        conFactory.release(con, lock);
    }
}
Also used : InsertHashtable(cbit.sql.InsertHashtable) KeyValue(org.vcell.util.document.KeyValue) Connection(java.sql.Connection)

Example 15 with InsertHashtable

use of cbit.sql.InsertHashtable in project vcell by virtualcell.

the class DBTopLevel method updateVersionable.

/**
 * This method was created in VisualAge.
 * @return cbit.sql.Versionable
 * @param object cbit.sql.Versionable
 * @param name java.lang.String
 * @param bVersion boolean
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.sql.SQLException The exception description.
 * @exception cbit.sql.RecordChangedException The exception description.
 */
KeyValue updateVersionable(User user, MathDescription mathDescription, KeyValue updatedGeometryKey, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = mathDB.updateVersionable(new InsertHashtable(), con, user, mathDescription, updatedGeometryKey, bVersion);
        con.commit();
        return versionKey;
    } catch (Throwable e) {
        lg.error(e.getMessage(), e);
        try {
            con.rollback();
        } catch (Throwable rbe) {
            // rbe.printStackTrace(System.out);
            lg.error("exception during rollback, bEnableRetry = " + bEnableRetry);
        }
        if (bEnableRetry && isBadConnection(con)) {
            conFactory.failed(con, lock);
            return updateVersionable(user, mathDescription, updatedGeometryKey, bVersion, false);
        } else {
            handle_DataAccessException_SQLException(e);
            // never gets here;
            return null;
        }
    } finally {
        conFactory.release(con, lock);
    }
}
Also used : InsertHashtable(cbit.sql.InsertHashtable) KeyValue(org.vcell.util.document.KeyValue) Connection(java.sql.Connection)

Aggregations

InsertHashtable (cbit.sql.InsertHashtable)16 Connection (java.sql.Connection)16 KeyValue (org.vcell.util.document.KeyValue)16