Search in sources :

Example 6 with SpatialDialect

use of org.hibernate.spatial.SpatialDialect in project hibernate-orm by hibernate.

the class HavingSridExpression method toSqlString.

@Override
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    final String column = ExpressionUtil.findColumn(propertyName, criteria, criteriaQuery);
    final SpatialDialect spatialDialect = ExpressionUtil.getSpatialDialect(criteriaQuery, SpatialFunction.srid);
    return spatialDialect.getHavingSridSQL(column);
}
Also used : SpatialDialect(org.hibernate.spatial.SpatialDialect)

Example 7 with SpatialDialect

use of org.hibernate.spatial.SpatialDialect in project hibernate-orm by hibernate.

the class IsEmptyExpression method toSqlString.

@Override
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    final String column = ExpressionUtil.findColumn(propertyName, criteria, criteriaQuery);
    final SpatialDialect spatialDialect = ExpressionUtil.getSpatialDialect(criteriaQuery, SpatialFunction.isempty);
    return spatialDialect.getIsEmptySQL(column, isEmpty);
}
Also used : SpatialDialect(org.hibernate.spatial.SpatialDialect)

Example 8 with SpatialDialect

use of org.hibernate.spatial.SpatialDialect in project hibernate-orm by hibernate.

the class SpatialFilter method toSqlString.

@Override
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
    final SessionFactoryImplementor factory = criteriaQuery.getFactory();
    final String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, this.propertyName);
    final Dialect dialect = factory.getDialect();
    if (dialect instanceof SpatialDialect) {
        final SpatialDialect seDialect = (SpatialDialect) dialect;
        return seDialect.getSpatialFilterExpression(columns[0]);
    } else {
        throw new IllegalStateException("Dialect must be spatially enabled dialect");
    }
}
Also used : SpatialDialect(org.hibernate.spatial.SpatialDialect) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) Dialect(org.hibernate.dialect.Dialect) SpatialDialect(org.hibernate.spatial.SpatialDialect)

Example 9 with SpatialDialect

use of org.hibernate.spatial.SpatialDialect in project hibernate-orm by hibernate.

the class OracleSpatialProjection method toSqlString.

@Override
public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery) throws HibernateException {
    final SessionFactoryImplementor factory = criteriaQuery.getFactory();
    final String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, this.propertyName);
    final Dialect dialect = factory.getDialect();
    if (dialect instanceof SpatialDialect) {
        final SpatialDialect seDialect = (SpatialDialect) dialect;
        return new StringBuffer(seDialect.getSpatialAggregateSQL(columns[0], this.aggregate)).append(" y").append(position).append("_").toString();
    } else {
        throw new IllegalStateException("Dialect must be spatially enabled dialect");
    }
}
Also used : SpatialDialect(org.hibernate.spatial.SpatialDialect) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) Dialect(org.hibernate.dialect.Dialect) SpatialDialect(org.hibernate.spatial.SpatialDialect)

Aggregations

SpatialDialect (org.hibernate.spatial.SpatialDialect)9 Dialect (org.hibernate.dialect.Dialect)5 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)4 Criteria (org.hibernate.Criteria)1 HibernateException (org.hibernate.HibernateException)1 CriteriaQuery (org.hibernate.criterion.CriteriaQuery)1 SimpleProjection (org.hibernate.criterion.SimpleProjection)1 TypedValue (org.hibernate.engine.spi.TypedValue)1 OracleSpatial10gDialect (org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect)1 Type (org.hibernate.type.Type)1