Search in sources :

Example 6 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, MathDescription mathDescription, 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 = mathDB.insertVersionable(new InsertHashtable(), con, user, mathDescription, 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, mathDescription, 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 7 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, Model model, String name, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = modelDB.insertVersionable(new InsertHashtable(), con, user, model, 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, model, 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 8 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(QueryHashtable dbc, User user, Geometry geometry, KeyValue updatedImageKey, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = geomDB.updateVersionable(new InsertHashtable(), dbc, con, user, geometry, updatedImageKey, 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(dbc, user, geometry, updatedImageKey, 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 9 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(QueryHashtable dbc, User user, Geometry geometry, KeyValue updatedImageKey, 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(), dbc, con, user, geometry, updatedImageKey, 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(dbc, user, geometry, updatedImageKey, 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 10 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, VCImage vcImage, boolean bVersion, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, RecordChangedException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        KeyValue versionKey = geomDB.updateVersionable(new InsertHashtable(), con, user, vcImage, 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, vcImage, 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