Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.LockException


            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


    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

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

          break;
        }
      }
      switch (errorType) {
        case StoreException.LOCK:
              return new LockException(msg);
        case StoreException.OBJECT_EXISTS:
              return new ObjectExistsException(msg);
        case StoreException.OBJECT_NOT_FOUND:
              return new ObjectNotFoundException(msg);
        case StoreException.OPTIMISTIC:
View Full Code Here

                }
                stmnt.setQueryTimeout(timeout / 1000);
            }
            rs = stmnt.executeQuery();
            if (!rs.next())
                throw new LockException(sm.getManagedInstance());
        } catch (SQLException se) {
            throw SQLExceptions.getStore(se, dict);
        } finally {
            if (stmnt != null)
                try { stmnt.close(); } catch (SQLException se) {}
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.