KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > criterion > Distinct


1 //$Id: Distinct.java,v 1.1 2005/04/18 17:16:56 oneovthafew Exp $
2
package org.hibernate.criterion;
3
4 import org.hibernate.Criteria;
5 import org.hibernate.HibernateException;
6 import org.hibernate.type.Type;
7
8 /**
9  * @author Gavin King
10  */

11 public class Distinct implements Projection {
12
13     private final Projection projection;
14     
15     public Distinct(Projection proj) {
16         this.projection = proj;
17     }
18
19     public String JavaDoc toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery)
20             throws HibernateException {
21         return "distinct " + projection.toSqlString(criteria, position, criteriaQuery);
22     }
23
24     public String JavaDoc toGroupSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
25             throws HibernateException {
26         return projection.toGroupSqlString(criteria, criteriaQuery);
27     }
28
29     public Type[] getTypes(Criteria criteria, CriteriaQuery criteriaQuery)
30             throws HibernateException {
31         return projection.getTypes(criteria, criteriaQuery);
32     }
33
34     public Type[] getTypes(String JavaDoc alias, Criteria criteria, CriteriaQuery criteriaQuery)
35             throws HibernateException {
36         return projection.getTypes(alias, criteria, criteriaQuery);
37     }
38
39     public String JavaDoc[] getColumnAliases(int loc) {
40         return projection.getColumnAliases(loc);
41     }
42
43     public String JavaDoc[] getColumnAliases(String JavaDoc alias, int loc) {
44         return projection.getColumnAliases(alias, loc);
45     }
46
47     public String JavaDoc[] getAliases() {
48         return projection.getAliases();
49     }
50
51     public boolean isGrouped() {
52         return projection.isGrouped();
53     }
54
55     public String JavaDoc toString() {
56         return "distinct " + projection.toString();
57     }
58 }
59
Popular Tags