Package javax.persistence

Examples of javax.persistence.PersistenceException


    private TransactionSynchronizationRegistry getSyncRegistry() {
        try {
            InitialContext ctx = new InitialContext();
            return (TransactionSynchronizationRegistry)ctx.lookup("java:comp/TransactionSynchronizationRegistry");
        } catch (NamingException e){
            throw new PersistenceException(e);
        }
    }
View Full Code Here


    } else if (parser.isMatch("limit")) {
      readLimit();

    } else {
      throw new PersistenceException("Query expected 'fetch', 'where','order by' or 'limit' keyword but got ["
          + parser.getWord() + "] \r " + parser.getOql());
    }
  }
View Full Code Here

      maxRows = Integer.parseInt(maxLimit);

      String offsetKeyword = parser.nextWord();
      if (offsetKeyword != null) {
        if (!parser.isMatch("offset")) {
          throw new PersistenceException("expected offset keyword but got " + parser.getWord());
        }
        String firstRowLimit = parser.nextWord();
        firstRow = Integer.parseInt(firstRowLimit);
        parser.nextWord();
      }
    } catch (NumberFormatException e) {
      String msg = "Expected an integer for maxRows or firstRows in limit offset clause";
      throw new PersistenceException(msg, e);
    }
  }
View Full Code Here

      } else if (!readAlias) {
        readAlias = true;

      } else {
        throw new PersistenceException("Expected (props) or new 'fetch' 'where' but got " + token);
      }
    }
    if (props != null) {
      props = props.substring(1, props.length() - 1);
    }
View Full Code Here

      this.connection = connection;
      this.onQueryOnly = manager == null ? OnQueryOnly.ROLLBACK : manager.getOnQueryOnly();
      this.persistenceContext = new DefaultPersistenceContext();

    } catch (Exception e) {
      throw new PersistenceException(e);
    }
  }
View Full Code Here

      throw new IllegalStateException(illegalStateMessage);
    }
    try {
      return connection.isReadOnly();
    } catch (SQLException e) {
      throw new PersistenceException(e);
    }
  }
View Full Code Here

        return StringHelper.replaceString(query, AND_PREDICATES, "");
      case NONE:
        return query;

      default:
        throw new PersistenceException("predicatesType " + predicatesType + " not handled");
      }
    } else {
      switch (predicatesType) {
      case HAVING:
        return StringHelper
            .replaceString(query, HAVING_PREDICATES, " HAVING " + predicates);
      case WHERE:
        return StringHelper.replaceString(query, WHERE_PREDICATES, " WHERE " + predicates);
      case AND:
        return StringHelper.replaceString(query, AND_PREDICATES, " AND " + predicates);
      case NONE:
        return query;

      default:
        throw new PersistenceException("predicatesType " + predicatesType + " not handled");
      }
    }
  }
View Full Code Here

    }
    try {
      localReadOnly = readOnly;
      connection.setReadOnly(readOnly);
    } catch (SQLException e) {
      throw new PersistenceException(e);
    }
  }
View Full Code Here

    }
    try {
      performRollback();

    } catch (Exception ex) {
      throw new PersistenceException(ex);
     
    } finally {
      // these will not throw an exception
      deactivate();
      notifyRollback(cause);
View Full Code Here

        OrmQueryProperties parentProp = fetchPaths.get(parentPath);
        if (parentProp == null) {
          ElPropertyValue el = d.getElGetValue(parentPath);
          if (el == null) {
            String msg = "Path [" + parentPath + "] not valid from " + d.getFullName();
            throw new PersistenceException(msg);
          }
          // add a missing parent path just fetching the Id property
          BeanPropertyAssoc<?> assocOne = (BeanPropertyAssoc<?>) el.getBeanProperty();
          parentProp = new OrmQueryProperties(parentPath, assocOne.getTargetIdProperty());
        }
View Full Code Here

TOP

Related Classes of javax.persistence.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.