Examples of NoResultException


Examples of javax.persistence.NoResultException

     * @throws IllegalStateException if called for an EJB QL UPDATE or DELETE statement
     */
    public Object getSingleResult() {
        List<?> rows = getResultList();
        if (rows.size() == 0) {
            throw new NoResultException();
        }
        if (rows.size() > 1) {
            throw new NonUniqueResultException();
        }

View Full Code Here

Examples of javax.persistence.NoResultException

            @Override
            public Page answer() throws Throwable {
                return (Page)EasyMock.getCurrentArguments()[0];
            }
        });
        expect(pageTemplateRepository.getDefaultPage(PageType.USER)).andThrow(new NoResultException("No Result Exception"));

        expect(pageRepository.getAllPages(user.getId(), PageType.USER)).andReturn(new ArrayList<Page>());
        replay(userService, pageLayoutRepository, pageRepository, pageTemplateRepository);

        Page newPage = pageService.addNewUserPage(PAGE_NAME, PAGE_LAYOUT_CODE);
View Full Code Here

Examples of javax.persistence.NoResultException

     * @throws IllegalStateException if called for an EJB QL UPDATE or DELETE statement
     */
    public Object getSingleResult() {
        List rows = getResultList();
        if (rows.size() == 0) {
            throw new NoResultException();
        }
        if (rows.size() > 1) {
            throw new NonUniqueResultException();
        }

View Full Code Here

Examples of javax.persistence.NoResultException

    public Object getSingleResult() throws AuditException, NonUniqueResultException, NoResultException {
        List result = list();

        if (result == null || result.size() == 0) {
            throw new NoResultException();
        }

        if (result.size() > 1) {
            throw new NonUniqueResultException();
        }
View Full Code Here

Examples of javax.persistence.NoResultException

  @SuppressWarnings( { "ThrowableInstanceNeverThrown", "unchecked" })
  public Object getSingleResult() {
    try {
      List result = query.list();
      if ( result.size() == 0 ) {
        throwPersistenceException( new NoResultException( "No entity found for query" ) );
      }
      else if ( result.size() > 1 ) {
        Set uniqueResult = new HashSet( result );
        if ( uniqueResult.size() > 1 ) {
          throwPersistenceException( new NonUniqueResultException( "result returns " + uniqueResult.size() + " elements" ) );
View Full Code Here

Examples of org.apache.openjpa.util.NoResultException

                single = rop.getResultObject();
                if (range.end != range.start + 1 && rop.next())
                    throw new NonUniqueResultException(_loc.get("not-unique",
                        _class, _query));
            } else if (_unique == Boolean.TRUE)
                throw new NoResultException(_loc.get("no-result",
                    _class, _query));

            // if unique set to false, use collection
            if (_unique == Boolean.FALSE) {
                if (!next)
View Full Code Here

Examples of org.apache.openjpa.util.NoResultException

                single = rop.getResultObject();
                if (range.end != range.start + 1 && rop.next())
                    throw new NonUniqueResultException(_loc.get("not-unique",
                        _class, _query));
            } else if (_unique == Boolean.TRUE)
                throw new NoResultException(_loc.get("no-result",
                    _class, _query));

            // if unique set to false, use collection
            if (_unique == Boolean.FALSE) {
                if (!next)
View Full Code Here

Examples of org.apache.openjpa.util.NoResultException

                single = rop.getResultObject();
                if (range.end != range.start + 1 && rop.next())
                    throw new NonUniqueResultException(_loc.get("not-unique",
                        _class, _query));
            } else if (_unique == Boolean.TRUE)
                throw new NoResultException(_loc.get("no-result",
                    _class, _query));

            // if unique set to false, use collection
            if (_unique == Boolean.FALSE) {
                if (!next)
View Full Code Here

Examples of org.apache.openjpa.util.NoResultException

                single = rop.getResultObject();
                if (range.end != range.start + 1 && rop.next())
                    throw new NonUniqueResultException(_loc.get("not-unique",
                        _class, _query));
            } else if (_unique == Boolean.TRUE)
                throw new NoResultException(_loc.get("no-result",
                    _class, _query));

            // if unique set to false, use collection
            if (_unique == Boolean.FALSE) {
                if (!next)
View Full Code Here

Examples of org.openrdf.result.NoResultException

  public BindingSet singleResult()
    throws StoreException
  {
    if (bindingSets.isEmpty()) {
      throw new NoResultException("expected zero, but was:" + bindingSets.size());
    }
    if (bindingSets.size() > 1) {
      throw new MultipleResultException("expected zero, but was:" + bindingSets.size());
    }
    return this.bindingSets.get(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.