Package org.apache.cayenne

Examples of org.apache.cayenne.CayenneException


        catch (CayenneException cex) {
            // rethrow unmodified
            throw cex;
        }
        catch (Exception otherex) {
            throw new CayenneException("Exception materializing id column.", Util
                    .unwindException(otherex));
        }
    }
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

        str.close();
      } catch (IOException ioex) {
        // this should never happen
      }

      throw new CayenneException(
        "Error getting ResultIterator: " + str.getBuffer());
    }

    return resultIterator;
  }
View Full Code Here

     * @param defaultEntity an entity needed to build ObjectIds for distinct comparison.
     */
    public DistinctResultIterator(ResultIterator wrappedIterator, DbEntity defaultEntity,
            boolean compareFullRows) throws CayenneException {
        if (wrappedIterator == null) {
            throw new CayenneException("Null wrapped iterator.");
        }

        if (defaultEntity == null) {
            throw new CayenneException("Null defaultEntity.");
        }

        this.wrappedIterator = wrappedIterator;
        this.defaultEntity = defaultEntity;
        this.fetchedIds = new HashSet<Map<String, Object>>();
View Full Code Here

        return nextDataRow != null;
    }

    public Map nextDataRow() throws CayenneException {
        if (!hasNextRow()) {
            throw new CayenneException(
                    "An attempt to read uninitialized row or past the end of the iterator.");
        }

        Map<String, Object> row = nextDataRow;
        checkNextRow();
View Full Code Here

     * Returns a Map for the next ObjectId. After calling this method, calls to
     * "nextDataRow()" will result in exceptions.
     */
    public Map nextObjectId(DbEntity entity) throws CayenneException {
        if (!hasNextRow()) {
            throw new CayenneException(
                    "An attempt to read uninitialized row or past the end of the iterator.");
        }

        Map<String, Object> row = nextDataRow;

View Full Code Here

        if (pk.size() != 1) {
            return nextObjectId(entity);
        }

        if (!hasNextRow()) {
            throw new CayenneException(
                    "An attempt to read uninitialized row or past the end of the iterator.");
        }

        Map<String, Object> row = nextDataRow;
View Full Code Here

        return row.get(pk.iterator().next().getName());
    }

    public void skipDataRow() throws CayenneException {
        if (!hasNextRow()) {
            throw new CayenneException(
                    "An attempt to read uninitialized row or past the end of the iterator.");
        }

        if (readingIds) {
            checkNextId(defaultEntity);
View Full Code Here

        }
    }

    void checkNextRow() throws CayenneException {
        if (readingIds) {
            throw new CayenneException(
                    "Can't go back from reading ObjectIds to reading rows.");
        }

        if (this.compareFullRows) {
            checkNextUniqueRow();
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.