Top Description Fields Constructors Methods
org.hibernate.criterion

public Class ProjectionList

extends Object
implements EnhancedProjection
Class Inheritance
All Implemented Interfaces
org.hibernate.criterion.EnhancedProjection, org.hibernate.criterion.Projection, java.io.Serializable
Imports
java.util.ArrayList, .Collections, .List, org.hibernate.Criteria, .HibernateException, org.hibernate.type.Type

A projection that wraps other projections to allow selecting multiple values.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private List<Projection>

Constructor Summary

AccessConstructor and Description
protected
ProjectionList()

Constructs a ProjectionList

Method Summary

Modifier and TypeMethod and Description
public ProjectionList

Returns:

this, for method chaining
add
(Projection
The projection to add
projection
)

Add a projection to this list of projections

public ProjectionList

Returns:

this, for method chaining
add
(Projection
The projection to add
projection
,
String
The alias to apply to the projection
alias
)

Adds a projection to this list of projections after wrapping it with an alias

public ProjectionList

Returns:

duh
create
()

Deprecated an instance factory method does not make sense
Lol
public String[]
getAliases()

Implements org.hibernate.criterion.Projection.getAliases.

Get the criteria-level aliases for this projection (ie.
public String[]
getColumnAliases(final int
Just as in toSqlString, represents the number of columns rendered prior to this projection.
loc
)

Implements org.hibernate.criterion.Projection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString.
public String[]
getColumnAliases(final int
Just as in toSqlString, represents the number of columns rendered prior to this projection.
loc
,
Criteria
The local criteria to which this project is attached (for resolution).
criteria
,
CriteriaQuery
The overall criteria query instance.
criteriaQuery
)

Implements org.hibernate.criterion.EnhancedProjection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString.
public String[]
getColumnAliases(String
The criteria-level alias
alias
,
final int
Just as in toSqlString, represents the number of columns rendered prior to this projection.
loc
)

Implements org.hibernate.criterion.Projection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString for a particular criteria-level alias.
public String[]
getColumnAliases(String
The criteria-level alias
alias
,
int
Just as in toSqlString, represents the number of columns rendered prior to this projection.
loc
,
Criteria
The local criteria to which this project is attached (for resolution).
criteria
,
CriteriaQuery
The overall criteria query instance.
criteriaQuery
)

Implements org.hibernate.criterion.EnhancedProjection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString for a particular criteria-level alias.
private static String[]
getColumnAliases(int loc, Criteria criteria, CriteriaQuery criteriaQuery, Projection projection)

private static String[]
getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery, Projection projection)

public int
public Projection

Returns:

The projection
getProjection
(int
The index of the projection to return
i
)

Access a wrapped projection by index

public Type[]
getTypes(Criteria
The local criteria to which this project is attached (for resolution).
criteria
,
CriteriaQuery
The overall criteria query instance.
criteriaQuery
)

Implements org.hibernate.criterion.Projection.getTypes.

Types returned by the rendered SQL fragment.
public Type[]
getTypes(String
The criteria-level alias for which to find types.
alias
,
Criteria
The local criteria to which this project is attached (for resolution).
criteria
,
CriteriaQuery
The overall criteria query instance.
criteriaQuery
)

Implements org.hibernate.criterion.Projection.getTypes.

Get the return types for a particular user-visible alias.
public boolean
isGrouped()

Implements org.hibernate.criterion.Projection.isGrouped.

Is this projection fragment (SELECT clause) also part of the GROUP BY
public String
toGroupSqlString(Criteria
The local criteria to which this project is attached (for resolution).
criteria
,
CriteriaQuery
The overall criteria query instance.
criteriaQuery
)

Implements org.hibernate.criterion.Projection.toGroupSqlString.

Render the SQL fragment to be used in the GROUP BY clause
public String
toSqlString(Criteria
The local criteria to which this project is attached (for resolution).
criteria
,
int
The number of columns rendered in the SELECT clause before this projection. Generally speaking this is useful to ensure uniqueness of the individual columns aliases.
loc
,
CriteriaQuery
The overall criteria query instance.
criteriaQuery
)

Implements org.hibernate.criterion.Projection.toSqlString.

Render the SQL fragment to be used in the SELECT clause.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

elementsback to summary
private List<Projection> elements

Constructor Detail

ProjectionListback to summary
protected ProjectionList()

Constructs a ProjectionList

See Also
Projections#projectionList()

Method Detail

addback to summary
public ProjectionList add(Projection projection)

Add a projection to this list of projections

Parameters
projection:Projection

The projection to add

Returns:ProjectionList

this, for method chaining

addback to summary
public ProjectionList add(Projection projection, String alias)

Adds a projection to this list of projections after wrapping it with an alias

Parameters
projection:Projection

The projection to add

alias:String

The alias to apply to the projection

Returns:ProjectionList

this, for method chaining

See Also
Projections#alias
createback to summary
public ProjectionList create()

Deprecated

an instance factory method does not make sense

Lol

Returns:ProjectionList

duh

Annotations
@Deprecated
See Also
Projections#projectionList()
getAliasesback to summary
public String[] getAliases()

Implements org.hibernate.criterion.Projection.getAliases.

Doc from org.hibernate.criterion.Projection.getAliases.

Get the criteria-level aliases for this projection (ie. the ones that will be passed to the org.hibernate.transform.ResultTransformer)

Returns:String[]

The aliases

Annotations
@Override
getColumnAliasesback to summary
public String[] getColumnAliases(final int loc)

Implements org.hibernate.criterion.Projection.getColumnAliases.

Doc from org.hibernate.criterion.Projection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString. Hibernate always uses column aliases to extract data from the JDBC java.sql.ResultSet, so it is important that these be implemented correctly in order for Hibernate to be able to extract these values correctly.

Parameters
loc:int

Just as in toSqlString, represents the number of columns rendered prior to this projection.

Returns:String[]

The columns aliases.

Annotations
@Override
getColumnAliasesback to summary
public String[] getColumnAliases(final int loc, Criteria criteria, CriteriaQuery criteriaQuery)

Implements org.hibernate.criterion.EnhancedProjection.getColumnAliases.

Doc from org.hibernate.criterion.EnhancedProjection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString. Hibernate always uses column aliases to extract data from the JDBC java.sql.ResultSet, so it is important that these be implemented correctly in order for Hibernate to be able to extract these values correctly.

Parameters
loc:int

Just as in toSqlString, represents the number of columns rendered prior to this projection.

criteria:Criteria

The local criteria to which this project is attached (for resolution).

criteriaQuery:CriteriaQuery

The overall criteria query instance.

Returns:String[]

The columns aliases.

Annotations
@Override
getColumnAliasesback to summary
public String[] getColumnAliases(String alias, final int loc)

Implements org.hibernate.criterion.Projection.getColumnAliases.

Doc from org.hibernate.criterion.Projection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString for a particular criteria-level alias.

Parameters
alias:String

The criteria-level alias

loc:int

Just as in toSqlString, represents the number of columns rendered prior to this projection.

Returns:String[]

The columns aliases pertaining to a particular criteria-level alias; expected to return null if this projection does not understand this alias.

Annotations
@Override
getColumnAliasesback to summary
public String[] getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery)

Implements org.hibernate.criterion.EnhancedProjection.getColumnAliases.

Doc from org.hibernate.criterion.EnhancedProjection.getColumnAliases.

Get the SQL column aliases used by this projection for the columns it writes for inclusion into the SELECT clause (toSqlString for a particular criteria-level alias.

Parameters
alias:String

The criteria-level alias

loc:int

Just as in toSqlString, represents the number of columns rendered prior to this projection.

criteria:Criteria

The local criteria to which this project is attached (for resolution).

criteriaQuery:CriteriaQuery

The overall criteria query instance.

Returns:String[]

The columns aliases pertaining to a particular criteria-level alias; expected to return null if this projection does not understand this alias.

Annotations
@Override
getColumnAliasesback to summary
private static String[] getColumnAliases(int loc, Criteria criteria, CriteriaQuery criteriaQuery, Projection projection)
getColumnAliasesback to summary
private static String[] getColumnAliases(String alias, int loc, Criteria criteria, CriteriaQuery criteriaQuery, Projection projection)
getLengthback to summary
public int getLength()
getProjectionback to summary
public Projection getProjection(int i)

Access a wrapped projection by index

Parameters
i:int

The index of the projection to return

Returns:Projection

The projection

Annotations
@SuppressWarnings:UnusedDeclaration
getTypesback to summary
public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException

Implements org.hibernate.criterion.Projection.getTypes.

Doc from org.hibernate.criterion.Projection.getTypes.

Types returned by the rendered SQL fragment. In other words what are the types that would represent the values this projection asked to be pulled into the result set?

Parameters
criteria:Criteria

The local criteria to which this project is attached (for resolution).

criteriaQuery:CriteriaQuery

The overall criteria query instance.

Returns:Type[]

The return types.

Annotations
@Override
Exceptions
HibernateException:
Indicates a problem resolving the types
getTypesback to summary
public Type[] getTypes(String alias, Criteria criteria, CriteriaQuery criteriaQuery)

Implements org.hibernate.criterion.Projection.getTypes.

Doc from org.hibernate.criterion.Projection.getTypes.

Get the return types for a particular user-visible alias.

Differs from getTypes(org.hibernate.Criteria, CriteriaQuery) in that here we are only interested in the types related to the given criteria-level alias.

Parameters
alias:String

The criteria-level alias for which to find types.

criteria:Criteria

The local criteria to which this project is attached (for resolution).

criteriaQuery:CriteriaQuery

The overall criteria query instance.

Returns:Type[]

The return types; expected to return null if this projection does not understand this alias.

Annotations
@Override
isGroupedback to summary
public boolean isGrouped()

Implements org.hibernate.criterion.Projection.isGrouped.

Doc from org.hibernate.criterion.Projection.isGrouped.

Is this projection fragment (SELECT clause) also part of the GROUP BY

Returns:boolean

True if the projection is also part of the GROUP BY; false otherwise.

Annotations
@Override
toGroupSqlStringback to summary
public String toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException

Implements org.hibernate.criterion.Projection.toGroupSqlString.

Doc from org.hibernate.criterion.Projection.toGroupSqlString.

Render the SQL fragment to be used in the GROUP BY clause

Parameters
criteria:Criteria

The local criteria to which this project is attached (for resolution).

criteriaQuery:CriteriaQuery

The overall criteria query instance.

Returns:String

The SQL fragment to plug into the GROUP BY

Annotations
@Override
Exceptions
HibernateException:
Indicates a problem performing the rendering
toSqlStringback to summary
public String toSqlString(Criteria criteria, int loc, CriteriaQuery criteriaQuery) throws HibernateException

Implements org.hibernate.criterion.Projection.toSqlString.

Doc from org.hibernate.criterion.Projection.toSqlString.

Render the SQL fragment to be used in the SELECT clause.

Parameters
criteria:Criteria

The local criteria to which this project is attached (for resolution).

loc:int

The number of columns rendered in the SELECT clause before this projection. Generally speaking this is useful to ensure uniqueness of the individual columns aliases.

criteriaQuery:CriteriaQuery

The overall criteria query instance.

Returns:String

The SQL fragment to plug into the SELECT

Annotations
@Override
Exceptions
HibernateException:
Indicates a problem performing the rendering
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override