当前位置: 首页>>代码示例>>Java>>正文


Java GenericDataSourceException类代码示例

本文整理汇总了Java中org.ofbiz.entity.GenericDataSourceException的典型用法代码示例。如果您正苦于以下问题:Java GenericDataSourceException类的具体用法?Java GenericDataSourceException怎么用?Java GenericDataSourceException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GenericDataSourceException类属于org.ofbiz.entity包,在下文中一共展示了GenericDataSourceException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLastExportTimestamp

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
private static Timestamp getLastExportTimestamp(SQLProcessor sqlproc) throws GenericDataSourceException, GenericEntityException, SQLException {
    if (sqlproc == null) {
        throw new IllegalArgumentException();
    }
    Timestamp lastTimestamp = null;
    String qStr = "SELECT last_successful_synch_time FROM ENTITY_SYNC WHERE  entity_sync_id = 'exportContactsToCrm2'";
    sqlproc.prepareStatement(qStr);
    ResultSet result = sqlproc.executeQuery();

    if (result != null && result.next()) {
        lastTimestamp = result.getTimestamp("last_successful_synch_time");

        result.close();
    }

    return lastTimestamp;
}
 
开发者ID:opentaps,项目名称:opentaps-crm2,代码行数:18,代码来源:ContactExportService.java

示例2: commit

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
/**
 * Commit all modifications
 *
 * @throws GenericDataSourceException
 */
public void commit() throws GenericDataSourceException {
    if (_connection == null) {
        return;
    }

    if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:commit() _manualTX=" + _manualTX, module);

    if (_manualTX) {
        try {
            _connection.commit();
            if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:commit() : called commit on connection", module);
        } catch (SQLException sqle) {
            Debug.logError(sqle, "Error committing transaction: " + sqle.toString());
            try {
                rollback();
            } catch (GenericDataSourceException rbsqle) {
                Debug.logError(rbsqle, "Got another error when trying to rollback after error committing transaction: " + sqle.toString());
            }
            throw new GenericDataSourceException("SQL Exception occurred on commit", sqle);
        }
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:28,代码来源:SQLProcessor.java

示例3: rollback

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
/**
 * Rollback all modifications
 */
public void rollback() throws GenericDataSourceException {
    if (_connection == null) {
        return;
    }

    if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:rollback() _manualTX=" + _manualTX, module);

    try {
        if (_manualTX) {
            _connection.rollback();
            if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:rollback() : _manualTX=" + _manualTX, module);
        } else {
            try {
                TransactionUtil.setRollbackOnly("rollback called in Entity Engine SQLProcessor", new Exception("Current Location Stack"));
                if (Debug.verboseOn()) Debug.logVerbose("SQLProcessor:rollback() : _manualTX=" + _manualTX, module);
            } catch (GenericTransactionException e) {
                Debug.logError(e, "Error setting rollback only", module);
                throw new GenericDataSourceException("Error setting rollback only", e);
            }
        }
    } catch (SQLException sqle2) {
        Debug.logWarning("[SQLProcessor.rollback]: SQL Exception while rolling back insert. Error was:" + sqle2, module);
        Debug.logWarning(sqle2, module);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:29,代码来源:SQLProcessor.java

示例4: getContactUserLoginSet

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
private static ResultSet getContactUserLoginSet(SQLProcessor sqlproc, Timestamp lastTimestamp, Timestamp now, String partyId) throws GenericDataSourceException, GenericEntityException, SQLException {
    if (sqlproc == null || lastTimestamp == null || now == null || partyId == null) {
        throw new IllegalArgumentException();
    }
    ResultSet result = null;

    StringBuilder qStr =  new StringBuilder("SELECT UL.user_login_id, UL.party_id, UL.current_password, UL.password_hint, UL.enabled, ULSG.group_id, SGP.permission_id FROM USER_LOGIN UL ")
         .append("JOIN USER_LOGIN_SECURITY_GROUP ULSG ON ULSG.user_login_id = UL.user_login_id ")
         .append("JOIN SECURITY_GROUP_PERMISSION SGP ON SGP.group_id = ULSG.group_id ")
         .append("WHERE UL.party_id = ? ")
         .append("AND (UL.enabled = 'Y' OR UL.enabled is null) ")
         .append("AND SGP.permission_id in ('FINANCIALS_ADMIN', 'FINANCIALS_VIEW', 'CRMSFA_VIEW') ")
         .append("AND ULSG.created_stamp >= ? ")
         .append("AND (ULSG.from_date <= ? AND (ULSG.thru_date >= ? OR ULSG.thru_date is null)) ");

    sqlproc.prepareStatement(qStr.toString());
    sqlproc.setValue(partyId);
    sqlproc.setValue(lastTimestamp);
    sqlproc.setValue(now);
    sqlproc.setValue(now);

    result = sqlproc.executeQuery();

    return result;
}
 
开发者ID:opentaps,项目名称:opentaps-crm2,代码行数:26,代码来源:ContactExportService.java

示例5: updateByCondition

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
public int updateByCondition(Delegator delegator, ModelEntity modelEntity, Map<String, ? extends Object> fieldsToSet, EntityCondition condition) throws GenericEntityException {
    SQLProcessor sqlP = new SQLProcessor(delegator, helperInfo);

    try {
        return updateByCondition(modelEntity, fieldsToSet, condition, sqlP);
    } catch (GenericDataSourceException e) {
        sqlP.rollback();
        throw new GenericDataSourceException("Generic Entity Exception occurred in updateByCondition", e);
    } finally {
        sqlP.close();
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:13,代码来源:GenericDAO.java

示例6: delete

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
public int delete(GenericEntity entity) throws GenericEntityException {
    SQLProcessor sqlP = new SQLProcessor(entity.getDelegator(), helperInfo);

    try {
        return delete(entity, sqlP);
    } catch (GenericDataSourceException e) {
        sqlP.rollback();
        throw new GenericDataSourceException("Exception while deleting the following entity: " + entity.toString(), e);
    } finally {
        sqlP.close();
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:13,代码来源:GenericDAO.java

示例7: deleteByCondition

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
public int deleteByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition condition) throws GenericEntityException {
    SQLProcessor sqlP = new SQLProcessor(delegator, helperInfo);

    try {
        return deleteByCondition(modelEntity, condition, sqlP);
    } catch (GenericDataSourceException e) {
        sqlP.rollback();
        throw new GenericDataSourceException("Generic Entity Exception occurred in deleteByCondition", e);
    } finally {
        sqlP.close();
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:13,代码来源:GenericDAO.java

示例8: prepareStatement

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
/**
 * Prepare a statement. In case no connection has been given, allocate a
 * new one.
 *
 * @param sql  The SQL statement to be executed
 *
 * @throws GenericDataSourceException
 * @throws GenericEntityException
 */
public void prepareStatement(String sql, boolean specifyTypeAndConcur, int resultSetType, int resultSetConcurrency, int fetchSize, int maxRows) throws GenericDataSourceException, GenericEntityException {
    if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.prepareStatement] sql=" + sql, module);

    if (_connection == null) {
        getConnection();
    }

    try {
        _sql = sql;
        _ind = 1;
        if (specifyTypeAndConcur) {
            _ps = _connection.prepareStatement(sql, resultSetType, resultSetConcurrency);
            if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.prepareStatement] _ps=" + _ps, module);
        } else {
            _ps = _connection.prepareStatement(sql);
            if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.prepareStatement] (def) _ps=" + _ps, module);
        }
        if (maxRows > 0) {
            _ps.setMaxRows(maxRows);
            if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.prepareStatement] max rows set : " + maxRows, module);
        }
        this.setFetchSize(_ps, fetchSize);
    } catch (SQLException sqle) {
        throw new GenericDataSourceException("SQL Exception while executing the following:" + sql, sqle);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:36,代码来源:SQLProcessor.java

示例9: executeQuery

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
/**
 * Execute a query based on the prepared statement
 *
 * @return The result set of the query
 * @throws GenericDataSourceException
 */
public ResultSet executeQuery() throws GenericDataSourceException {
    try {
        // if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.executeQuery] ps=" + _ps.toString(), module);
        _rs = _ps.executeQuery();
    } catch (SQLException sqle) {
        this.checkLockWaitInfo(sqle);
        throw new GenericDataSourceException("SQL Exception while executing the following:" + _sql, sqle);
    }

    return _rs;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:SQLProcessor.java

示例10: executeUpdate

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
/**
 * Execute updates
 *
 * @return  The number of rows updated
 * @throws GenericDataSourceException
 */
public int executeUpdate() throws GenericDataSourceException {
    try {
        // if (Debug.verboseOn()) Debug.logVerbose("[SQLProcessor.executeUpdate] ps=" + _ps.toString(), module);
        //TransactionUtil.printAllThreadsTransactionBeginStacks();
        return _ps.executeUpdate();
    } catch (SQLException sqle) {
        this.checkLockWaitInfo(sqle);
        // don't display this here, may not be critical, allow handling further up... Debug.logError(sqle, "SQLProcessor.executeUpdate() : ERROR : ", module);
        throw new GenericDataSourceException("SQL Exception while executing the following:" + _sql, sqle);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:SQLProcessor.java

示例11: next

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
/**
 * Test if there more records available
 *
 * @return true, if there more records available
 *
 * @throws GenericDataSourceException
 */
public boolean next() throws GenericDataSourceException {
    try {
        return _rs.next();
    } catch (SQLException sqle) {
        throw new GenericDataSourceException("SQL Exception while executing the following:" + _sql, sqle);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:15,代码来源:SQLProcessor.java

示例12: updateByCondition

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
public int updateByCondition(ModelEntity modelEntity, Map<String, ? extends Object> fieldsToSet, EntityCondition condition) throws GenericEntityException {
    SQLProcessor sqlP = new SQLProcessor(helperInfo);

    try {
        return updateByCondition(modelEntity, fieldsToSet, condition, sqlP);
    } catch (GenericDataSourceException e) {
        sqlP.rollback();
        throw new GenericDataSourceException("Generic Entity Exception occured in updateByCondition", e);
    } finally {
        sqlP.close();
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:13,代码来源:GenericDAO.java

示例13: delete

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
public int delete(GenericEntity entity) throws GenericEntityException {
    SQLProcessor sqlP = new SQLProcessor(helperInfo);

    try {
        return delete(entity, sqlP);
    } catch (GenericDataSourceException e) {
        sqlP.rollback();
        throw new GenericDataSourceException("Exception while deleting the following entity: " + entity.toString(), e);
    } finally {
        sqlP.close();
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:13,代码来源:GenericDAO.java

示例14: deleteByCondition

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
public int deleteByCondition(ModelEntity modelEntity, EntityCondition condition) throws GenericEntityException {
    SQLProcessor sqlP = new SQLProcessor(helperInfo);

    try {
        return deleteByCondition(modelEntity, condition, sqlP);
    } catch (GenericDataSourceException e) {
        sqlP.rollback();
        throw new GenericDataSourceException("Generic Entity Exception occured in deleteByCondition", e);
    } finally {
        sqlP.close();
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:13,代码来源:GenericDAO.java

示例15: saveLastExportTimestamp

import org.ofbiz.entity.GenericDataSourceException; //导入依赖的package包/类
private static void saveLastExportTimestamp(SQLProcessor sqlproc, Timestamp lastTimestamp, boolean firstExport) throws GenericDataSourceException, GenericEntityException, SQLException {
    if (lastTimestamp == null) {
        throw new IllegalArgumentException();
    }

    String qStr = "";
    if (firstExport) {
        qStr = "INSERT INTO ENTITY_SYNC (entity_sync_id, last_successful_synch_time) VALUES ('exportContactsToCrm2', ?)";
    } else {
        qStr = "UPDATE ENTITY_SYNC SET last_successful_synch_time = ? WHERE entity_sync_id = 'exportContactsToCrm2'";
    }
    sqlproc.prepareStatement(qStr);
    sqlproc.setValue(lastTimestamp);
    sqlproc.executeUpdate();
}
 
开发者ID:opentaps,项目名称:opentaps-crm2,代码行数:16,代码来源:ContactExportService.java


注:本文中的org.ofbiz.entity.GenericDataSourceException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。