Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.StoreException


        if (_setCharStream == null) {
            try {
                _setCharStream = clob.getClass().getMethod
                    ("setCharacterStream", new Class[]{ long.class });
            } catch (Exception e) {
                throw new StoreException(e);
            }
        }

        Writer writer = (Writer) invokePutLobMethod(_setCharStream, clob,
            new Object[]{ Numbers.valueOf(1L) });
View Full Code Here


            return method.invoke(target, args);
        } catch (InvocationTargetException ite) {
            Throwable t = ite.getTargetException();
            if (t instanceof SQLException)
                throw(SQLException) t;
            throw new StoreException(t);
        } catch (Exception e) {
            throw new StoreException(e);
        }
    }
View Full Code Here

                orig.getClass().getName(),
                converted,
            });

            if (storageLimitationsFatal)
                throw new StoreException(msg);

            if (warn)
                log.warn(msg);
            else
                log.trace(msg);
View Full Code Here

     * Throws an exception by default if {@link #lastGeneratedKeyQuery} is null.
     */
    public Object getGeneratedKey(Column col, Connection conn)
        throws SQLException {
        if (lastGeneratedKeyQuery == null)
            throw new StoreException(_loc.get("no-auto-assign"));

        // replace things like "SELECT MAX({0}) FROM {1}"
        String query = lastGeneratedKeyQuery;
        if (query.indexOf('{') != -1) // only if the token is in the string
        {
            query = MessageFormat.format(query, new Object[]{
                col.getName(), getFullName(col.getTable(), false),
                getGeneratedKeySequenceName(col),
            });
        }

        PreparedStatement stmnt = conn.prepareStatement(query);
        ResultSet rs = null;
        try {
            rs = stmnt.executeQuery();
            if (!rs.next())
                throw new StoreException(_loc.get("no-genkey"));
            Object key = rs.getObject(1);
            if (key == null)
                log.warn(_loc.get("invalid-genkey", col));
            return key;
        } finally {
View Full Code Here

    public OpenJPAException newStoreException(String msg, SQLException[] causes,
        Object failed) {
        if (causes.length > 0 && "23000".equals(causes[0].getSQLState()))
            return new ReferentialIntegrityException(msg).
                setFailedObject(failed).setNestedThrowables(causes);
        return new StoreException(msg).setFailedObject(failed).
            setNestedThrowables(causes);
    }
View Full Code Here

            throw ke.setFatal(true);
        } catch (RuntimeException re) {
            // if we already started the transaction, don't let it commit
            if ((_flags & FLAG_ACTIVE) != 0)
                setRollbackOnlyInternal(re);
            throw new StoreException(re).setFatal(true);
        }

        if (_pending != null) {
            StateManagerImpl sm;
            for (Iterator it = _pending.iterator(); it.hasNext();) {
View Full Code Here

            if ((_flags & FLAG_STORE_ACTIVE) == 0)
                beginStoreManagerTransaction(false);
        } catch (OpenJPAException ke) {
            throw ke;
        } catch (RuntimeException re) {
            throw new StoreException(re);
        } finally {
            endOperation();
        }
    }
View Full Code Here

                _log.trace(_loc.get("end-trans-error"), ke);
            throw ke;
        } catch (Exception e) {
            if (_log.isTraceEnabled())
                _log.trace(_loc.get("end-trans-error"), e);
            throw new StoreException(e);
        } finally {
            endOperation();
        }
    }
View Full Code Here

                _log.trace(_loc.get("end-trans-error"), ke);
            throw ke;
        } catch (Exception e) {
            if (_log.isTraceEnabled())
                _log.trace(_loc.get("end-trans-error"), e);
            throw new StoreException(e);
        } finally {
            endOperation();
        }
    }
View Full Code Here

                setRollbackOnly(ke);
                throw ke.setFatal(true);
            } catch (RuntimeException re) {
                // rollback on flush error; objects may be in inconsistent state
                setRollbackOnly(re);
                throw new StoreException(re).setFatal(true);
            }
        }
        finally {
            endOperation();
        }
View Full Code Here

TOP

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

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.