Methods Summary |
---|
public static org.hibernate.criterion.Order | asc(java.lang.String propertyName)Ascending order
return new Order(propertyName, true);
|
public static org.hibernate.criterion.Order | desc(java.lang.String propertyName)Descending order
return new Order(propertyName, false);
|
public org.hibernate.criterion.Order | ignoreCase()
ignoreCase = true;
return this;
|
public java.lang.String | toSqlString(org.hibernate.Criteria criteria, CriteriaQuery criteriaQuery)Render the SQL fragment
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
Type type = criteriaQuery.getTypeUsingProjection(criteria, propertyName);
StringBuffer fragment = new StringBuffer();
for ( int i=0; i<columns.length; i++ ) {
SessionFactoryImplementor factory = criteriaQuery.getFactory();
boolean lower = ignoreCase && type.sqlTypes( factory )[i]==Types.VARCHAR;
if (lower) {
fragment.append( factory.getDialect().getLowercaseFunction() )
.append('(");
}
fragment.append( columns[i] );
if (lower) fragment.append(')");
fragment.append( ascending ? " asc" : " desc" );
if ( i<columns.length-1 ) fragment.append(", ");
}
return fragment.toString();
|
public java.lang.String | toString()
return propertyName + ' " + (ascending?"asc":"desc");
|