Package org.hibernate.criterion

Examples of org.hibernate.criterion.DistanceOrder


    Point p = (new GeometryFactory()).createPoint(coordinate);
    p.setSRID(LogicConstants.SRID);

    try {

      final DistanceOrder order = DistanceOrder
          .des("historico1_.geom", p);

      // final Criteria criteria = currentSession.createCriteria(
      // Recurso.class).setResultTransformer(
      // Criteria.DISTINCT_ROOT_ENTITY).createAlias("historicoGps",
      // "historico").createCriteria("flotas").createCriteria(
      // "roles").createCriteria("usuarios").add(
      // Restrictions.eq("id", u.getId())).addOrder(order)
      // .setMaxResults(num);

      Query criteria = currentSession
          .createSQLQuery(
              "select this_.* from recursos this_ "
                  + "inner join flotas flota2_ on this_.flota_x_flota=flota2_.x_flota "
                  + "inner join ROLES_X_FLOTAS roles15_ on flota2_.x_flota=roles15_.X_FLOTA "
                  + "inner join roles rol3_ on roles15_.X_ROL=rol3_.x_rol "
                  + "inner join usuarios usuario4_ on rol3_.x_rol=usuario4_.fk_roles "
                  + "inner join historico_gps historico1_ on this_.fk_historico_gps=historico1_.x_historico "
                  + ((u != null && u.getId() != null) ? "where usuario4_.x_usuarios=:ID "
                      + " and historico1_.marca_temporal > :TIMEOUT "
                      : "") + "order by "
                  + order.toString())
          .addEntity(Recurso.class)
          .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
          .setMaxResults(num);

      if (u != null && u.getId() != null) {
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.DistanceOrder

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.