类 Projections
- java.lang.Object
-
- org.hibernate.criterion.Projections
-
public final class Projections extends Object
The criterion package may be used by applications as a framework for building new kinds of Projection. However, it is intended that most applications will simply use the built-in projection types via the static factory methods of this class. The factory methods that take an alias allow the projected value to be referred to by criterion and order instances. See also theRestrictionsfactory methods for generatingCriterioninstances- 作者:
- Gavin King, Steve Ebersole
- 另请参阅:
Criteria
-
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Projectionalias(Projection projection, String alias)Assign an alias to a projection, by wrapping itstatic AggregateProjectionavg(String propertyName)A property average value projectionstatic CountProjectioncount(String propertyName)A property value count projectionstatic CountProjectioncountDistinct(String propertyName)A distinct property value count projectionstatic Projectiondistinct(Projection projection)Create a distinct projection from a projection.static PropertyProjectiongroupProperty(String propertyName)A grouping property value projectionstatic IdentifierProjectionid()An identifier value projection.static AggregateProjectionmax(String propertyName)A property maximum value projectionstatic AggregateProjectionmin(String propertyName)A property minimum value projectionstatic ProjectionListprojectionList()Create a new projection list.static PropertyProjectionproperty(String propertyName)A property value projectionstatic ProjectionrowCount()The query row count, ie.static ProjectionsqlGroupProjection(String sql, String groupBy, String[] columnAliases, Type[] types)A grouping SQL projection, specifying both select clause and group by clause fragmentsstatic ProjectionsqlProjection(String sql, String[] columnAliases, Type[] types)A SQL projection, a typed select clause fragmentstatic AggregateProjectionsum(String propertyName)A property value sum projection
-
-
-
方法详细资料
-
property
public static PropertyProjection property(String propertyName)
A property value projection- 参数:
propertyName- The name of the property whose values should be projected- 返回:
- The property projection
- 另请参阅:
PropertyProjection
-
groupProperty
public static PropertyProjection groupProperty(String propertyName)
A grouping property value projection- 参数:
propertyName- The name of the property to group- 返回:
- The grouped projection
- 另请参阅:
PropertyProjection
-
id
public static IdentifierProjection id()
An identifier value projection.- 返回:
- The identifier projection
- 另请参阅:
IdentifierProjection
-
distinct
public static Projection distinct(Projection projection)
Create a distinct projection from a projection.- 参数:
projection- The project to treat distinctly- 返回:
- The distinct projection
- 另请参阅:
Distinct
-
projectionList
public static ProjectionList projectionList()
Create a new projection list.- 返回:
- The projection list
-
rowCount
public static Projection rowCount()
The query row count, ie. count(*)- 返回:
- The projection representing the row count
- 另请参阅:
RowCountProjection
-
count
public static CountProjection count(String propertyName)
A property value count projection- 参数:
propertyName- The name of the property to count over- 返回:
- The count projection
- 另请参阅:
CountProjection
-
countDistinct
public static CountProjection countDistinct(String propertyName)
A distinct property value count projection- 参数:
propertyName- The name of the property to count over- 返回:
- The count projection
- 另请参阅:
CountProjection
-
max
public static AggregateProjection max(String propertyName)
A property maximum value projection- 参数:
propertyName- The property for which to find the max- 返回:
- the max projection
- 另请参阅:
AggregateProjection
-
min
public static AggregateProjection min(String propertyName)
A property minimum value projection- 参数:
propertyName- The property for which to find the min- 返回:
- the min projection
- 另请参阅:
AggregateProjection
-
avg
public static AggregateProjection avg(String propertyName)
A property average value projection- 参数:
propertyName- The property over which to find the average- 返回:
- the avg projection
- 另请参阅:
AvgProjection
-
sum
public static AggregateProjection sum(String propertyName)
A property value sum projection- 参数:
propertyName- The property over which to sum- 返回:
- the sum projection
- 另请参阅:
AggregateProjection
-
alias
public static Projection alias(Projection projection, String alias)
Assign an alias to a projection, by wrapping it- 参数:
projection- The projection to be aliasedalias- The alias to apply- 返回:
- The aliased projection
- 另请参阅:
AliasedProjection
-
sqlProjection
public static Projection sqlProjection(String sql, String[] columnAliases, Type[] types)
A SQL projection, a typed select clause fragment- 参数:
sql- The SQL fragmentcolumnAliases- The column aliasestypes- The resulting types- 返回:
- The SQL projection
- 另请参阅:
SQLProjection
-
sqlGroupProjection
public static Projection sqlGroupProjection(String sql, String groupBy, String[] columnAliases, Type[] types)
A grouping SQL projection, specifying both select clause and group by clause fragments- 参数:
sql- The SQL SELECT fragmentgroupBy- The SQL GROUP BY fragmentcolumnAliases- The column aliasestypes- The resulting types- 返回:
- The SQL projection
- 另请参阅:
SQLProjection
-
-