Package org.exolab.castor.jdo

Examples of org.exolab.castor.jdo.PersistenceException


        try {
           if (_rs != null) {
              retval = _rs.absolute(row);
           }
        } catch (SQLException e) {
           throw new PersistenceException(e.getMessage(), e);
        }
        return retval;
    }
View Full Code Here


              } else {
                 _rs.beforeFirst();
              }
           }
        } catch (SQLException se) {
           throw new PersistenceException(se.getMessage());
        }
        return retval;
    }
View Full Code Here

                } catch (SQLException e2) {
                    LOG.warn("Problem closing JDBC statement", e2);
                }
            }
            _resultSetDone = true;
            throw new PersistenceException(Messages.format(
                    "persist.nested", except) + " while executing " + _sql, except);
        }
    }
View Full Code Here

            // "skip" all rows till the first one with a new identity.
            fetchRaw();

        } catch (SQLException except) {
            _lastIdentity = null;
            throw new PersistenceException(Messages.format("persist.nested", except), except);
        }
        return nextIdentity;
    }
View Full Code Here

                returnValues = SQLHelper.calculateNumberOfFields(extendingClassDescriptors,
                        _requestedEngine.getColumnInfoForIdentities().length,
                        _requestedEngine.getInfo().length, numberOfExtendLevels, this._rs);
            } catch (SQLException e) {
                LOG.error ("Problem calculating number of concrete fields.", e);
                throw new PersistenceException("Problem calculating number of concrete fields.", e);
            }
           
            leafDescriptor = (ClassDescriptor) returnValues[0];
           
            _engine = _requestedEngine;
            if (leafDescriptor != null) {
                if (!leafDescriptor.getJavaClass().getName().equals(
                        _requestedEngine.getDescriptor().getJavaClass().getName())) {
                    originalFieldNumber = ((Integer) returnValues[1]).intValue();
                   
                    Persistence newEngine = null;
                    try {
                        newEngine = _requestedFactory.getPersistence(leafDescriptor);
                    } catch (MappingException e) {
                        LOG.error("Problem obtaining persistence engine for "
                                + leafDescriptor.getJavaClass().getName(), e);
                        throw new PersistenceException("Problem obtaining persistence engine for "
                                + leafDescriptor.getJavaClass().getName(), e);
                    }
                    _engine = (SQLEngine) newEngine;
                }
            }
        }
       
        _fields = new Object[originalFieldNumber];

        // It would prove a little difficult to fetch if we don't have any rows with data left :-)
        if (_resultSetDone) { return null; }

        Object   stamp = null;

        Object[] wantedIdentity;
        Object[] currentIdentity;

        try {
            wantedIdentity = loadSQLIdentity();

            // Load first (and perhaps only) row of object data from _rs into <_fields> array.
            // As we assume that we have called fetch() immediatly after nextIdentity(),
            // we can be sure that it belongs to the object we want. This is probably not the
            // safest programming style, but has to suffice currently :-)
            loadRow(_fields, originalFieldNumber, true);

            // We move forward in the ResultSet, until we see another identity or run out of rows.
            while (_rs.next()) {
                // Load identity from current row.
                currentIdentity = loadSQLIdentity();

                // Compare with wantedIdentity and determine if it is a new one.
                if (identitiesEqual(wantedIdentity, currentIdentity)) {
                    // Load next row of object data from _rs into <_fields> array.
                    loadRow(_fields, originalFieldNumber, false);
                } else {
                    // We are done with all the rows for our obj. and still have rows left.
                    _lastIdentity = currentIdentity;

                    // As stamp is never set, this function always returns null ... ???
                    // (Don't ask me, it was like that before I modified the code! :-)
                    return stamp;
                }
            }

            // We are done with all the rows for our obj. and don't have any rows left.
            _resultSetDone = true;
            _lastIdentity = null;
        } catch (SQLException except) {
            throw new PersistenceException(Messages.format("persist.nested", except), except);
        }

        return null;
    }
View Full Code Here

                    _ctx.close();
                } catch (Exception except) {
                    _log.debug("Exception at close of TransactionContext.");
                }
               
                throw new PersistenceException(Messages.message("jdo.dbClosedTxRolledback"));
            }
        } finally {
            _scope = null;
        }
    }
View Full Code Here

     */
    public void begin() throws PersistenceException {
        _log.debug("Beginning tx");

        if (isActive()) {
            throw new PersistenceException(Messages.message("jdo.txInProgress"));
        }

        // _ctx.setStatus(Status.STATUS_ACTIVE);
        _ctx.setStatus(0);
       
View Full Code Here

     * @see org.exolab.castor.jdo.Database#getJdbcConnection()
     */
    public Connection getJdbcConnection() throws PersistenceException {
        if (_ctx == null || !_ctx.isOpen()) {
            String message = Messages.message("jdo.dbTxNotInProgress.jdbc");
            throw new PersistenceException (message);
        }
        return _ctx.getConnection(_scope.getLockEngine());
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public boolean isLocked(final Class cls, final Object identity) throws PersistenceException {
        if (identity == null) {
            throw new PersistenceException("Identities can't be null!");
        }
        if (_scope == null) {
            throw new PersistenceException(Messages.message("jdo.dbClosed"));
        }
        if (isActive()) {
            return _ctx.isLocked(cls, new Identity(identity), _scope.getLockEngine());
        }
        return false;
View Full Code Here

     *         in progress.
     */
    private Object load(final Class type, final Object identity, final Object object,
            final AccessMode mode) throws PersistenceException {
        if (identity == null) {
            throw new PersistenceException("Identities can't be null!");
        }
        if (_scope == null) {
            throw new PersistenceException(Messages.message("jdo.dbClosed"));
        }
        TransactionContext tx = getTransaction();
        ClassMolder molder = _scope.getClassMolder(type);
        ProposedEntity proposedObject = new ProposedEntity(molder);
        return tx.load(new Identity(identity), proposedObject, mode);
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.