类 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 the Restrictions factory methods for generating Criterion instances
    作者:
    Gavin King, Steve Ebersole
    另请参阅:
    Criteria
    • 方法详细资料

      • 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
      • 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
      • alias

        public static Projection alias​(Projection projection,
                                       String alias)
        Assign an alias to a projection, by wrapping it
        参数:
        projection - The projection to be aliased
        alias - 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 fragment
        columnAliases - The column aliases
        types - 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 fragment
        groupBy - The SQL GROUP BY fragment
        columnAliases - The column aliases
        types - The resulting types
        返回:
        The SQL projection
        另请参阅:
        SQLProjection