Search in sources :

Example 1 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, SimulationContext simulationContext, KeyValue updatedMathDescriptionKey, Model updatedModel, KeyValue updatedGeometryKey, String name, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = simContextDB.insertVersionable(new InsertHashtable(), con, user, simulationContext, updatedMathDescriptionKey, updatedModel, updatedGeometryKey, 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, simulationContext, updatedMathDescriptionKey, updatedModel, updatedGeometryKey, 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 2 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, SimulationContext simulationContext, KeyValue updatedMathDescriptionKey, Model updatedModel, KeyValue updatedGeometryKey, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = simContextDB.updateVersionable(new InsertHashtable(), con, user, simulationContext, updatedMathDescriptionKey, updatedModel, 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, simulationContext, updatedMathDescriptionKey, updatedModel, 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)

Example 3 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, Simulation simulation, KeyValue updatedMathDescriptionKey, boolean bVersion, boolean bMathematicallyEquivalent, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = simulationDB.updateVersionable(new InsertHashtable(), con, user, simulation, updatedMathDescriptionKey, bVersion, bMathematicallyEquivalent);
        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, simulation, updatedMathDescriptionKey, bVersion, bMathematicallyEquivalent, 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 4 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, MathModelMetaData mathModelMetaData, MathModelChildSummary mmcs, String name, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = mathModelDB.insertVersionable(new InsertHashtable(), con, user, mathModelMetaData, mmcs, 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, mathModelMetaData, mmcs, 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 5 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, VCImage vcImage, String name, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = geomDB.insertVersionable(new InsertHashtable(), con, user, vcImage, 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, vcImage, 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)

Aggregations

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