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 java.util.List;
20  
21  import org.apache.commons.logging.Log;
22  import org.apache.commons.logging.LogFactory;
23  import org.bejug.javacareers.jobs.dao.OrganisationDao;
24  import org.bejug.javacareers.jobs.model.Organisation;
25  import org.springframework.dao.DataAccessException;
26  import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
27  
28  /***
29   * The Organisation Dao Hibernate implementation class.
30   *
31   * @author Sven Schauwvliege (last modified by $Author: bavo_jcs $
32   * @version $Revision: 1.3 $  $Date: 2005/09/30 14:38:08 $
33   */
34  public class OrganisationDaoHibernateImpl
35          extends HibernateDaoSupport
36          implements OrganisationDao {
37  
38      private static final Log LOG = LogFactory.getLog(OrganisationDaoHibernateImpl.class);
39      /***
40       * {@inheritDoc}
41       */
42      public void store(Organisation organisation) throws DataAccessException {
43          organisation.getAddress().setModificationDate(organisation.getModificationDate());
44          getHibernateTemplate().saveOrUpdate(organisation);
45      }
46  
47      /***
48       * {@inheritDoc}
49       */
50      public Organisation getOrganisation(Integer id) throws DataAccessException {
51          LOG.info("Debug: Getting organisation:" +id);
52          return (Organisation) getHibernateTemplate().load(Organisation.class, id);
53      }
54  
55      /***
56       * {@inheritDoc}
57       */
58      public List getOrganisations() throws DataAccessException {
59          return getHibernateTemplate().loadAll(Organisation.class);
60      }
61  
62  }
63  
64  /***
65   * $Log: OrganisationDaoHibernateImpl.java,v $
66   * Revision 1.3  2005/09/30 14:38:08  bavo_jcs
67   * Fixed URL
68   *
69   * Revision 1.2  2005/09/13 08:11:17  schauwvliege
70   * organize imports
71   *
72   * Revision 1.1  2005/08/26 07:58:30  ge0ffrey
73   * split up the sources in service, serviceimpl and webclient
74   *
75   * Revision 1.10  2005/08/10 09:04:48  bavo_jcs
76   * Optimized imports according to checkstyle
77   *
78   * Revision 1.9  2005/08/09 12:59:55  bavo_jcs
79   * Optimized imports
80   *
81   * Revision 1.8  2005/08/04 11:52:11  bme_jcs
82   * resolved checkstyle errors
83   *
84   * Revision 1.7  2005/08/03 13:14:09  bme_jcs
85   * getDao's removed and storeObject renamed to store
86   *
87   * Revision 1.6  2005/07/13 11:42:16  bavo_jcs
88   * Ajax rename and test-cleanup
89   *
90   * Revision 1.5  2005/07/13 11:16:59  bavo_jcs
91   * Moved Ajax files
92   *
93   * Revision 1.4  2005/07/07 14:55:44  bavo_jcs
94   * Ajax integration
95   *
96   * Revision 1.3  2005/06/14 13:40:04  schauwvliege
97   * Renamed add to store
98   *
99   * Revision 1.2  2005/06/09 08:18:44  bejug_cc
100  * Fix initial import
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 12:49:30  ssc
115  * Checstyle errors
116  *
117  * Revision 1.4  2005/05/11 10:14:52  ssc
118  * Checstyle errors
119  *
120  * Revision 1.3  2005/05/10 09:54:02  ssc
121  * Removed AbstractPersistableObject
122  *
123  * Revision 1.2  2005/05/04 09:47:56  bme
124  * modified for introduction AOP
125  *
126  * Revision 1.1  2005/04/29 18:17:34  sja
127  * General cleanup (naming conv., javadoc and CVS tags)
128  *
129  */