1 /***
2 Copyright (C) 2005 The Java Community
3
4 This program is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free Software
6 Foundation; either version 2 of the License, or (at your option) any later
7 version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 Place, Suite 330, Boston, MA 02111-1307 USA.
16
17 */
18 package org.bejug.javacareers.jobs.dao.hibernate;
19
20 import java.util.List;
21
22 import org.bejug.javacareers.jobs.dao.ParameterDao;
23 import org.bejug.javacareers.jobs.model.AbstractParameter;
24 import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
25
26 /***
27 * Generic dao-implementation for all parameterDao's.
28 * This class doesn't implement the getParameters-method, this is delayed to
29 * the concrete subdao's.
30 * @author Bart Meyers
31 * @version $Revision: 1.2 $ $Date: 2005/08/31 12:16:11 $
32 *
33 */
34 public abstract class AbstractParameterDaoHibernateImpl
35 extends HibernateDaoSupport
36 implements ParameterDao {
37
38 /***
39 * holds the Class this dao refers to
40 */
41 private Class clazz = null;
42
43
44 /***
45 * @return the Class this dao refers to
46 */
47 public Class getClazz() {
48 return clazz;
49 }
50
51 /***
52 * @param clazz the Class this dao has to refer to
53 */
54 public void setClazz(Class clazz) {
55 this.clazz = clazz;
56 }
57
58
59 /***
60 * {@inheritDoc}
61 */
62 public List getParameters() {
63 return getHibernateTemplate().loadAll(clazz);
64 }
65
66 /***
67 * {@inheritDoc}
68 */
69 public AbstractParameter getParameter(Integer id) {
70 return (AbstractParameter) getHibernateTemplate().get(getClazz(), id);
71 }
72
73 /***
74 * {{@inheritDoc}}
75 */
76 public void deleteParameter(AbstractParameter parameter) {
77 getHibernateTemplate().delete(parameter);
78 }
79
80 /***
81 * {{@inheritDoc}}
82 */
83 public void deleteParameter(Integer id) {
84 getHibernateTemplate().delete(getParameter(id));
85 }
86
87 /***
88 * {@inheritDoc}
89 */
90 public void store(AbstractParameter parameter) {
91 getHibernateTemplate().saveOrUpdate(parameter);
92 }
93 }
94 /***
95 * $Log: AbstractParameterDaoHibernateImpl.java,v $
96 * Revision 1.2 2005/08/31 12:16:11 bme_jcs
97 * refactoring of the abstract base-classes
98 *
99 * Revision 1.1 2005/08/26 07:58:30 ge0ffrey
100 * split up the sources in service, serviceimpl and webclient
101 *
102 * Revision 1.6 2005/08/10 09:04:48 bavo_jcs
103 * Optimized imports according to checkstyle
104 *
105 * Revision 1.5 2005/08/09 12:59:55 bavo_jcs
106 * Optimized imports
107 *
108 * Revision 1.4 2005/08/03 13:14:09 bme_jcs
109 * getDao's removed and storeObject renamed to store
110 *
111 * Revision 1.3 2005/06/14 13:40:04 schauwvliege
112 * Renamed add to store
113 *
114 * Revision 1.2 2005/06/09 08:18:44 bejug_cc
115 * Fix initial import
116 *
117 * Revision 1.4 2005/05/30 09:31:47 bme
118 * updated for the introduction of HQL in the hbm-files
119 *
120 * Revision 1.3 2005/05/11 10:14:52 ssc
121 * Checstyle errors
122 *
123 * Revision 1.2 2005/05/10 09:54:02 ssc
124 * Removed AbstractPersistableObject
125 *
126 * Revision 1.1 2005/05/09 13:24:34 bme
127 * First Release
128 *
129 */