01: //$Id: NaturalIdentifier.java 6899 2005-05-25 01:22:07Z oneovthafew $
02: package org.hibernate.criterion;
03:
04: import org.hibernate.Criteria;
05: import org.hibernate.HibernateException;
06: import org.hibernate.engine.TypedValue;
07:
08: /**
09: * @author Gavin King
10: */
11: public class NaturalIdentifier implements Criterion {
12:
13: private Junction conjunction = new Conjunction();
14:
15: public TypedValue[] getTypedValues(Criteria criteria,
16: CriteriaQuery criteriaQuery) throws HibernateException {
17: return conjunction.getTypedValues(criteria, criteriaQuery);
18: }
19:
20: public String toSqlString(Criteria criteria,
21: CriteriaQuery criteriaQuery) throws HibernateException {
22: return conjunction.toSqlString(criteria, criteriaQuery);
23: }
24:
25: public NaturalIdentifier set(String property, Object value) {
26: conjunction.add(Restrictions.eq(property, value));
27: return this;
28: }
29:
30: }
|