Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.LockException


        if (subtype == StoreException.OBJECT_NOT_FOUND || cause instanceof ObjectNotFoundException) {
                e = new org.apache.openjpa.persistence.EntityNotFoundException(msg, nested, failed, fatal);
        } else if (subtype == StoreException.OPTIMISTIC  || cause instanceof OptimisticException) {
              e = new org.apache.openjpa.persistence.OptimisticLockException(msg, nested, failed, fatal);
        } else if (subtype == StoreException.LOCK || cause instanceof LockException) {
            LockException lockEx = (LockException) (ke instanceof LockException ? ke : cause);
            if (lockEx != null && lockEx.getLockLevel() >= MixedLockLevels.LOCK_PESSIMISTIC_READ) {
                if (!lockEx.isFatal()) {
                    e = new org.apache.openjpa.persistence.LockTimeoutException(msg, nested, failed);
                } else {
                    e = new org.apache.openjpa.persistence.PessimisticLockException(msg, nested, failed);
                }
            } else {
View Full Code Here


    OpenJPAException narrow(String msg, SQLException ex, Object failed) {
        int errorType = matchErrorState(sqlStateCodes, ex);
        StoreException storeEx;
        switch (errorType) {
        case StoreException.LOCK:
            storeEx = new LockException(failed);
            break;
        case StoreException.OBJECT_EXISTS:
            storeEx = new ObjectExistsException(msg);
            break;
        case StoreException.OBJECT_NOT_FOUND:
View Full Code Here

                dict.setTimeouts(stmnt, fetch, true);
                rs = executeQuery(conn, stmnt, sql);
                checkLock(rs, sm, timeout);
            }
        } catch (SQLException se) {
            LockException e = new LockException(sm.getPersistenceCapable(), timeout, level);
            e.setCause(se);
            e.setFatal(dict.isFatalException(StoreException.LOCK, se)
                    || level >= MixedLockLevels.LOCK_PESSIMISTIC_READ);
            throw e;
        } finally {
            if (stmnt != null)
                try { stmnt.close(); } catch (SQLException se) {}
View Full Code Here

     * implementation of checking lock from the result set.
     */
    protected void checkLock(ResultSet rs, OpenJPAStateManager sm, int timeout)
        throws SQLException {
        if (!rs.next())
            throw new LockException(sm.getManagedInstance(), timeout);
        return;
    }
View Full Code Here

            msg = se.getClass().getName();
        SQLException[] ses = getSQLExceptions(se);
        OpenJPAException storeEx = (dict == null) ? new StoreException(msg).setFailedObject(failed)
                .setNestedThrowables(ses) : dict.newStoreException(msg, ses, failed);
        if (level != -1 && storeEx.getSubtype() == StoreException.LOCK) {
            LockException lockEx = (LockException) storeEx;
            lockEx.setLockLevel(level);
        }
        return storeEx;
    }
View Full Code Here

        if (subtype == StoreException.OBJECT_NOT_FOUND || cause instanceof ObjectNotFoundException) {
                e = new org.apache.openjpa.persistence.EntityNotFoundException(msg, nested, failed, fatal);
        } else if (subtype == StoreException.OPTIMISTIC  || cause instanceof OptimisticException) {
              e = new org.apache.openjpa.persistence.OptimisticLockException(msg, nested, failed, fatal);
        } else if (subtype == StoreException.LOCK || cause instanceof LockException) {
            LockException lockEx = (LockException) (ke instanceof LockException ? ke : cause);
            if (lockEx != null && lockEx.getLockLevel() >= MixedLockLevels.LOCK_PESSIMISTIC_READ) {
                if (!lockEx.isFatal()) {
                    e = new org.apache.openjpa.persistence.LockTimeoutException(msg, nested, failed);
                } else {
                    e = new org.apache.openjpa.persistence.PessimisticLockException(msg, nested, failed);
                }
            } else {
View Full Code Here

    OpenJPAException narrow(String msg, SQLException ex, Object failed) {
        int errorType = matchErrorState(sqlStateCodes, ex);
        StoreException storeEx;
        switch (errorType) {
        case StoreException.LOCK:
            storeEx = new LockException(failed);
            break;
        case StoreException.OBJECT_EXISTS:
            storeEx = new ObjectExistsException(msg);
            break;
        case StoreException.OBJECT_NOT_FOUND:
View Full Code Here

    OpenJPAException narrow(String msg, SQLException ex, Object failed) {
        int errorType = matchErrorState(sqlStateCodes, ex);
        StoreException storeEx;
        switch (errorType) {
        case StoreException.LOCK:
            storeEx = new LockException(failed);
            break;
        case StoreException.OBJECT_EXISTS:
            storeEx = new ObjectExistsException(msg);
            break;
        case StoreException.OBJECT_NOT_FOUND:
View Full Code Here

                dict.setTimeouts(stmnt, fetch, true);
                rs = executeQuery(conn, stmnt, sql);
                checkLock(rs, sm, timeout);
            }
        } catch (SQLException se) {
            LockException e = new LockException(sm.getPersistenceCapable(), timeout, level);
            e.setCause(se);
            e.setFatal(dict.isFatalException(StoreException.LOCK, se)
                    || level >= MixedLockLevels.LOCK_PESSIMISTIC_READ);
            throw e;
        } finally {
            if (stmnt != null)
                try { stmnt.close(); } catch (SQLException se) {}
View Full Code Here

     * implementation of checking lock from the result set.
     */
    protected void checkLock(ResultSet rs, OpenJPAStateManager sm, int timeout)
        throws SQLException {
        if (!rs.next())
            throw new LockException(sm.getManagedInstance(), timeout);
        return;
    }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.util.LockException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.