Package br.net.woodstock.rockframework.domain.persistence

Examples of br.net.woodstock.rockframework.domain.persistence.PersistenceException


          q = entityManager.createNativeQuery(filter.getFilter(), (Class) targetEntity);
        } else if (targetEntity instanceof String) {
          try {
            q = entityManager.createNativeQuery(filter.getFilter(), Class.forName((String) targetEntity));
          } catch (ClassNotFoundException e) {
            throw new PersistenceException(e);
          }
        } else {
          throw new PersistenceException("Invalid option[" + ORMOptions.OPTION_TARGET_ENTITY + "] " + targetEntity);
        }
      } else {
        q = entityManager.createNativeQuery(filter.getFilter());
      }
    } else {
View Full Code Here


    Map<String, Object> options = filter.getOptions();

    Query q = null;

    if (filter.getType() == ORMFilterType.NAMED) {
      throw new PersistenceException("Hibernate dont support named queries");
    } else if (filter.getType() == ORMFilterType.NATIVE) {
      if ((Conditions.isContainingKey(options, ORMOptions.OPTION_TARGET_ENTITY))) {
        Object targetEntity = options.get(ORMOptions.OPTION_TARGET_ENTITY);
        if (targetEntity instanceof Class) {
          SQLQuery sq = session.createSQLQuery(filter.getFilter());
          sq.addEntity((Class) targetEntity);
          q = sq;
        } else if (targetEntity instanceof String) {
          try {
            SQLQuery sq = session.createSQLQuery(filter.getFilter());
            sq.addEntity(Class.forName((String) targetEntity));
            q = sq;
          } catch (ClassNotFoundException e) {
            throw new PersistenceException(e);
          }
        } else {
          throw new PersistenceException("Invalid option[" + ORMOptions.OPTION_TARGET_ENTITY + "] " + targetEntity);
        }
      } else {
        q = session.createSQLQuery(filter.getFilter());
      }
    } else {
View Full Code Here

    Assert.notNull(filter, "query");

    Query q = null;

    if (filter.getType() == ORMFilterType.NAMED) {
      throw new PersistenceException("Hibernate dont support named queries");
    } else if (filter.getType() == ORMFilterType.NATIVE) {
      q = session.createSQLQuery(filter.getCountQuery());
    } else {
      q = session.createQuery(filter.getCountQuery());
    }
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.domain.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.