01: //$Id: Projection.java 5685 2005-02-12 07:19:50Z steveebersole $
02: package org.hibernate.criterion;
03:
04: import java.io.Serializable;
05:
06: import org.hibernate.Criteria;
07: import org.hibernate.HibernateException;
08: import org.hibernate.type.Type;
09:
10: /**
11: * An object-oriented representation of a query result set projection
12: * in a <tt>Criteria</tt> query. Built-in projection types are provided
13: * by the <tt>Projections</tt> factory class.
14: * This interface might be implemented by application classes that
15: * define custom projections.
16: *
17: * @see Projections
18: * @see org.hibernate.Criteria
19: * @author Gavin King
20: */
21: public interface Projection extends Serializable {
22:
23: /**
24: * Render the SQL fragment
25: * @param criteriaQuery
26: * @param columnAlias
27: * @return String
28: * @throws HibernateException
29: */
30: public String toSqlString(Criteria criteria, int position,
31: CriteriaQuery criteriaQuery) throws HibernateException;
32:
33: /**
34: * Render the SQL fragment to be used in the group by clause
35: * @param criteriaQuery
36: * @param columnAlias
37: * @return String
38: * @throws HibernateException
39: */
40: public String toGroupSqlString(Criteria criteria,
41: CriteriaQuery criteriaQuery) throws HibernateException;
42:
43: /**
44: * Return types returned by the rendered SQL fragment
45: * @param criteria
46: * @param criteriaQuery
47: * @return Type[]
48: * @throws HibernateException
49: */
50: public Type[] getTypes(Criteria criteria,
51: CriteriaQuery criteriaQuery) throws HibernateException;
52:
53: /**
54: * Return types for a particular user-visible alias
55: */
56: public Type[] getTypes(String alias, Criteria criteria,
57: CriteriaQuery criteriaQuery) throws HibernateException;
58:
59: /**
60: * Get the SQL select clause column aliases
61: */
62: public String[] getColumnAliases(int loc);
63:
64: /**
65: * Get the SQL select clause column aliases for a particular
66: * user-visible alias
67: */
68: public String[] getColumnAliases(String alias, int loc);
69:
70: /**
71: * Get the user-visible aliases for this projection
72: * (ie. the ones that will be passed to the
73: * <tt>ResultTransformer</tt>)
74: */
75: public String[] getAliases();
76:
77: /**
78: * Does this projection specify grouping attributes?
79: */
80: public boolean isGrouped();
81:
82: }
|