Package org.exolab.castor.jdo

Examples of org.exolab.castor.jdo.PersistenceException


    public Object getValue(final PreparedStatement stmt)
    throws PersistenceException, SQLException {
        ResultSet rs = stmt.executeQuery();
        if (rs.next()) { return _sqlTypeHandler.getValue(rs); }
        String msg = Messages.format("persist.keyGenFailed", _keyGenerator.getClass().getName());
        throw new PersistenceException(msg);
    }
View Full Code Here


            stmt = conn.prepareStatement(sql);
            return getValue(stmt);
        } catch (SQLException e) {
            String msg = Messages.format("persist.keyGenSQL",
                    _keyGenerator.getClass().getName(), e.toString());
            throw new PersistenceException(msg);
        } finally {
            if (stmt != null) {
                try {
                    stmt.close();
                } catch (SQLException ex) {
View Full Code Here

               
                if (success) {
                    if (!_sameConnection) { conn.commit(); }
                } else {
                    if (!_sameConnection) { conn.rollback(); }
                    throw new PersistenceException(Messages.format(
                            "persist.keyGenFailed", getClass().getName()));
                }
            } catch (SQLException ex) {
                try {
                    if (!_sameConnection) { conn.rollback(); }
                } catch (SQLException ex2) {
                    LOG.warn ("Problem rolling back JDBC transaction.", ex2);
                }
                throw new PersistenceException(Messages.format(
                        "persist.keyGenSQL", getClass().getName(), ex.toString()), ex);
            } finally {
                try {
                    if (stmt != null) { stmt.close(); }
                } catch (SQLException ex) {
View Full Code Here

                stmt = conn.prepareCall("{call IDENTITY()}");
                v = getValue(stmt);
            } catch (SQLException e) {
                String msg = Messages.format("persist.keyGenSQL",
                        getClass().getName(), e.toString());
                throw new PersistenceException(msg);
            } finally {
                if (stmt != null) {
                    try {
                        stmt.close();
                    } catch (SQLException ex) {
View Full Code Here

            final String primKeyName, final Properties props) throws PersistenceException {
        try {
            return _type.getValue(conn, tableName, primKeyName, props);
        } catch (Exception e) {
            LOG.error("Problem generating new key", e);
            throw new PersistenceException(Messages.format("persist.keyGenSQL", e));
        }
    }
View Full Code Here

            String sql = getQueryExpression(tableName, primKeyName);
            stmt = conn.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();
            return _sqlTypeHandler.getValue(rs);
        } catch (SQLException ex) {
            throw new PersistenceException(Messages.format(
                    "persist.keyGenSQL", getClass().getName(), ex.toString()), ex);
        } finally {
            if (stmt != null) {
                try {
                    stmt.close();
View Full Code Here

                    _stmt.close();
                } catch (SQLException e2) {
                    _log.warn (Messages.message ("persist.stClosingFailed"), e2);
                }
            }
            throw new PersistenceException(Messages.format("persist.nested", except));
        }
    }
View Full Code Here

                    } else
                    // fail-fast principle: if the object depend on another
                    // object,
                    // throw exception
                    if (!tx.isDepended(oid, oo)) {
                        throw new PersistenceException(
                                "Dependent object may not change its master");
                    }
                } else if (tx.isAutoStore()) {
                    if (!tx.isRecorded(oo)) {
                        tx.markCreate(fieldClassMolder, oo, null);
View Full Code Here

                    } else
                    // fail-fast principle: if the object depend on another
                    // object,
                    // throw exception
                    if (!tx.isDepended(oid, oo)) {
                        throw new PersistenceException(
                                "Dependent object may not change its master");
                    }
                } else if (tx.isAutoStore()) {
                    if (!tx.isRecorded(oo)) {
                        boolean creating = tx.markUpdate(fieldClassMolder, oo, null);
View Full Code Here

                    _stmt.close();
                } catch (SQLException e2) {
                    _log.warn (Messages.message ("persist.stClosingFailed"), e2);
                }
            }
            throw new PersistenceException(Messages.format("persist.nested", except));
        }
    }
View Full Code Here

TOP

Related Classes of org.exolab.castor.jdo.PersistenceException

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.