View Javadoc

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  package org.bejug.javacareers.jobs.dao.hibernate;
18  
19  import org.bejug.javacareers.jobs.dao.JobOfferDao;
20  import org.bejug.javacareers.jobs.model.JobOffer;
21  import org.bejug.javacareers.jobs.model.Offer;
22  import org.bejug.javacareers.jobs.model.User;
23  import org.springframework.dao.DataAccessException;
24  
25  import java.util.List;
26  
27  /***
28   * The Job Offer hibernate data access object implementation.
29   *
30   * @author Bart Meyers (last modified by $Author: stephan_janssen $)
31   * @version $Revision: 1.3 $ - $Date: 2005/10/11 08:43:56 $
32   */
33  
34  public class JobOfferDaoHibernateImpl extends OfferDaoHibernateImpl
35                                        implements JobOfferDao {
36  
37      /***
38       * {@inheritDoc}
39       */
40      public List getOffers() throws DataAccessException {
41          return getHibernateTemplate().loadAll(JobOffer.class);
42      }
43  
44      /***
45       * {@inheritDoc}
46       */
47      public Offer getOffer(Integer id) throws DataAccessException {
48          return (JobOffer) getHibernateTemplate().load(JobOffer.class, id);
49      }
50      
51      /***
52       * {@inheritDoc}
53       */
54      public int getOfferCount() throws DataAccessException {
55          return getOfferCount("countJobOffers");
56      }
57  
58       /***
59       * {@inheritDoc}
60       */
61      public int getUserJobOfferCount(User currentUser) throws DataAccessException {
62          return  (getHibernateTemplate().findByNamedQueryAndNamedParam(
63                  "countCurrentUserJobOffers", "user", currentUser)).size();
64      }
65  
66  
67  
68  }
69  
70  /***
71   * $Log: JobOfferDaoHibernateImpl.java,v $
72   * Revision 1.3  2005/10/11 08:43:56  stephan_janssen
73   * Reformat code.
74   *
75   * Revision 1.2  2005/09/13 08:11:17  schauwvliege
76   * organize imports
77   *
78   * Revision 1.1  2005/08/26 07:58:30  ge0ffrey
79   * split up the sources in service, serviceimpl and webclient
80   *
81   * Revision 1.7  2005/08/10 09:04:48  bavo_jcs
82   * Optimized imports according to checkstyle
83   *
84   * Revision 1.6  2005/08/09 12:59:55  bavo_jcs
85   * Optimized imports
86   *
87   * Revision 1.5  2005/08/08 09:38:22  bme_jcs
88   * resolved checkstyle errors
89   *
90   * Revision 1.4  2005/08/05 07:50:31  psong09
91   * added named query to Offer
92   *
93   * Revision 1.3  2005/08/03 13:14:09  bme_jcs
94   * getDao's removed and storeObject renamed to store
95   *
96   * Revision 1.2  2005/06/09 08:18:44  bejug_cc
97   * Fix initial import
98   *
99   * Revision 1.10  2005/05/30 14:56:58  bme
100  * added count-methods
101  *
102  * Revision 1.9  2005/05/30 09:31:47  bme
103  * updated for the introduction of HQL in the hbm-files
104  *
105  * Revision 1.8  2005/05/25 11:06:53  ssc
106  * added DBUnit tests and fixed some errors
107  *
108  * Revision 1.7  2005/05/12 08:23:55  ssc
109  * Checkstyle errors
110  *
111  * Revision 1.6  2005/05/11 17:44:15  sja
112  * Moved all dao Hibernate queries variables to HQLConstants.
113  *
114  * Revision 1.5  2005/05/11 10:14:52  ssc
115  * Checstyle errors
116  *
117  * Revision 1.4  2005/05/02 12:11:04  bme
118  * minor change, introduced an interface for holding the HQL-queries
119  *
120  * Revision 1.3  2005/04/29 12:18:05  bme
121  * updated to meet the model
122  *
123  * Revision 1.4  2005/04/29 05:48:59  bme
124  * first release
125  *
126  * Revision 1.2  2005/04/23 14:31:36  sja
127  * changed getAllOffers to getOffers
128  *
129  * Revision 1.1  2005/04/19 11:51:22  PSONG09
130  * First release
131  *
132  * Revision 1.3  2005/04/18 18:48:07  sja
133  * Added CVS class header tags.
134  *
135  * Revision 1.2  2005/04/18 14:15:20  bme
136  * *** empty log message ***
137  *
138  * Revision 1.1  2005/04/15 14:44:50  sja
139  * Updated implementation.
140  *
141  * Revision 1.1  2005/04/15 13:17:49  bme
142  * *** empty log message ***
143  *
144  */