2 * $Id: HibernateQueryFactory.java,v 1.1 2004/11/06 16:20:48 idfx Exp $
4 * Copyright (C) 2001, 2002, 2003, 2004 The Mir-coders group
6 * This file is part of Mir.
8 * Mir is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Mir is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Mir; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * In addition, as a special exception, The Mir-coders gives permission to link
23 * the code of this program with any library licensed under the Apache Software License,
24 * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
25 * (or with modified versions of the above that use the same license as the above),
26 * and distribute linked combinations including the two. You must obey the
27 * GNU General Public License in all respects for all of the code used other than
28 * the above mentioned libraries. If you modify this file, you may extend this
29 * exception to your version of the file, but you are not obligated to do so.
30 * If you do not wish to do so, delete this exception statement from your version.
32 package org.codecoop.mir.core.dao.hibernate;
36 import org.codecoop.mir.core.dao.IQueryCriteria;
37 import org.codecoop.mir.core.dao.IQueryExpression;
38 import org.codecoop.mir.core.dao.IQueryFactory;
39 import org.codecoop.mir.core.dao.IQueryOrder;
40 import org.codecoop.mir.core.dao.QueryFailure;
43 * HibernateQueryFactory
45 * @version $Revision: 1.1 $
47 public class HibernateQueryFactory implements IQueryFactory {
50 * @see org.codecoop.mir.core.dao.IQueryFactory#createCriteria(java.lang.Class)
52 public IQueryCriteria createCriteria(Class persistentClass) throws QueryFailure {
53 return new QueryCriteria(persistentClass);
57 * @see org.codecoop.mir.core.dao.IQueryFactory#descOrder(java.lang.String)
59 public IQueryOrder descOrder(String property) {
60 return new QueryOrder(property, QueryOrder.DESC);
64 * @see org.codecoop.mir.core.dao.IQueryFactory#ascOrder(java.lang.String)
66 public IQueryOrder ascOrder(String property) {
67 return new QueryOrder(property, QueryOrder.ASC);
71 * @see org.codecoop.mir.core.dao.IQueryFactory#allEq(java.util.Map)
73 public IQueryExpression allEq(Map propertyNameValue) {
74 return new AllEqExpression(propertyNameValue);
78 * @see org.codecoop.mir.core.dao.IQueryFactory#eq(java.lang.String, java.lang.Object, boolean)
80 public IQueryExpression eq(String property, Object value, boolean ignoreCase) {
81 return new EqExpression(property, value, ignoreCase);
85 * @see org.codecoop.mir.core.dao.IQueryFactory#eq(java.lang.String, java.lang.Object, boolean)
87 public IQueryExpression eq(String property, Object value) {
88 return new EqExpression(property, value);
92 * @see org.codecoop.mir.core.dao.IQueryFactory#not(org.codecoop.mir.core.query.IQueryExpression)
94 public IQueryExpression not(IQueryExpression expression) {
95 return new NotExpression(expression);
99 * @see org.codecoop.mir.core.dao.IQueryFactory#gt(java.lang.String, java.lang.Object)
101 public IQueryExpression gt(String property, Object value) {
102 return new GtExpression(property, value);
106 * @see org.codecoop.mir.core.dao.IQueryFactory#ge(java.lang.String, java.lang.Object)
108 public IQueryExpression ge(String property, Object value) {
109 return new GeExpression(property, value);
113 * @see org.codecoop.mir.core.dao.IQueryFactory#lt(java.lang.String, java.lang.Object)
115 public IQueryExpression lt(String property, Object value) {
116 return new LtExpression(property, value);
120 * @see org.codecoop.mir.core.dao.IQueryFactory#le(java.lang.String, java.lang.Object)
122 public IQueryExpression le(String property, Object value) {
123 return new LeExpression(property, value);
127 * @see org.codecoop.mir.core.dao.IQueryFactory#like(java.lang.String, java.lang.Object)
129 public IQueryExpression like(String property, Object value) {
130 return new LikeExpression(property, value);