Example usage for org.hibernate.criterion CriteriaQuery getSQLAlias

List of usage examples for org.hibernate.criterion CriteriaQuery getSQLAlias

Introduction

In this page you can find the example usage for org.hibernate.criterion CriteriaQuery getSQLAlias.

Prototype

public String getSQLAlias(Criteria criteria, String propertyPath);

Source Link

Document

Get the root table alias of an entity, taking into account the qualifier of the property path

Usage

From source file:com.closertag.smartmove.server.content.persistence.hibernate.DistanceRestriction.java

License:Open Source License

public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    String[] columnName = criteriaQuery.getColumnsUsingProjection(criteria,
            alias + "." + GpsPosition.LOCATION_COLUMN_NAME);

    StringBuffer result = new StringBuffer("( distance_sphere(").append(columnName[0]).append(", ?) <=")
            .append(this.distance).append(")");
    return useIndex ? result.append(" AND ")
            .append(getBoundingBox(//  w  ww. ja va  2s .c  o m
                    criteriaQuery.getSQLAlias(criteria, alias + "." + GpsPosition.LOCATION_COLUMN_NAME),
                    this.point.getY(), this.point.getX(), distance))
            .toString() : result.toString();

}