Package org.apache.cayenne

Examples of org.apache.cayenne.CayenneException


        }
    }

    void checkNextId(DbEntity entity) throws CayenneException {
        if (entity == null) {
            throw new CayenneException("Null DbEntity, can't create id.");
        }

        this.readingIds = true;
        this.nextDataRow = null;
View Full Code Here


     * set up.
     */
    public void execute() throws CayenneException {
        // sanity check
        if (sourceNode == null) {
            throw new CayenneException("Can't port data, source node is null.");
        }

        if (destinationNode == null) {
            throw new CayenneException("Can't port data, destination node is null.");
        }

        // the simple equality check may actually detect problems with misconfigred nodes
        // it is not as dumb as it may look at first
        if (sourceNode == destinationNode) {
            throw new CayenneException(
                    "Can't port data, source and target nodes are the same.");
        }

        if (entities == null || entities.isEmpty()) {
            return;
View Full Code Here

                tx.rollback();
            }
            catch (Exception rollbackEx) {
            }

            throw new CayenneException(e);
        }
        finally {
            if(Transaction.getThreadTransaction() == tx) {
                Transaction.bindThreadTransaction(null);
            }
View Full Code Here

        Throwable e = new Throwable();
        assertSame(e, Util.unwindException(e));
    }

    public void testUnwindException2() throws Exception {
        CayenneException e = new CayenneException();
        assertSame(e, Util.unwindException(e));
    }
View Full Code Here

        assertSame(e, Util.unwindException(e));
    }

    public void testUnwindException3() throws Exception {
        Throwable root = new Throwable();
        CayenneException e = new CayenneException(root);
        assertSame(root, Util.unwindException(e));
    }
View Full Code Here

        }
        else if (query instanceof DeleteBatchQuery) {
            return factory.createDeleteQueryBuilder(adapter);
        }
        else {
            throw new CayenneException("Unsupported batch query: " + query);
        }
    }
View Full Code Here

                result = internalPerformIteratedQuery(query);
            }
            catch (Exception e) {
                Transaction.bindThreadTransaction(null);
                tx.setRollbackOnly();
                throw new CayenneException(e);
            }
            finally {
                // note: we are keeping the transaction bound to the current thread on
                // success - iterator will unbind it. Unsetting a transaction here would
                // result in some strangeness, at least on Ingres
View Full Code Here

        }
        else if (query instanceof UpdateBatchQuery) {
            queryBuilder = new LOBUpdateBatchQueryBuilder(getAdapter());
        }
        else {
            throw new CayenneException(
                    "Unsupported batch type for special LOB processing: " + query);
        }

        queryBuilder.setTrimFunction(OracleAdapter.TRIM_FUNCTION);
        queryBuilder.setNewBlobFunction(OracleAdapter.NEW_BLOB_FUNCTION);
View Full Code Here

            select.setString(1, entity.getName());
            ResultSet rs = select.executeQuery();

            if (!rs.next()) {
                throw new CayenneException("PK lookup failed for table: "
                        + entity.getName());
            }

            long nextId = rs.getLong(1);

            rs.updateLong(1, nextId + pkCacheSize);
            rs.updateRow();

            if (rs.next()) {
                throw new CayenneException("More than one PK record for table: "
                        + entity.getName());
            }
           
            rs.close();
View Full Code Here

            select.setString(1, entity.getName());
            ResultSet rs = select.executeQuery();

            if (!rs.next()) {
                throw new CayenneException("PK lookup failed for table: "
                        + entity.getName());
            }

            int nextId = rs.getInt(1);

            rs.updateInt(1, nextId + pkCacheSize);
            rs.updateRow();

            if (rs.next()) {
                throw new CayenneException("More than one PK record for table: "
                        + entity.getName());
            }
           
            rs.close();
View Full Code Here

TOP

Related Classes of org.apache.cayenne.CayenneException

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.