KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > persistence > hibernate > core > GlobalPropertyDAOHibernate


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.blandware.atleap.persistence.hibernate.core;
17
18 import com.blandware.atleap.model.core.GlobalProperty;
19 import com.blandware.atleap.persistence.core.GlobalPropertyDAO;
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.List JavaDoc;
23
24
25 /**
26  * <p>This class interacts with Spring's HibernateTemplate to save/delete and
27  * retrieve GlobalProperty objects.
28  * </p>
29  * <p><a HREF="GlobalPropertyDAOHibernate.java.htm"><i>View Source</i></a>
30  * </p>
31  *
32  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
33  */

34 public class GlobalPropertyDAOHibernate extends BaseDAOHibernate implements GlobalPropertyDAO {
35
36     /**
37      * @see com.blandware.atleap.persistence.core.GlobalPropertyDAO#createGlobalProperty(com.blandware.atleap.model.core.GlobalProperty)
38      */

39     public void createGlobalProperty(GlobalProperty globalProperty) {
40         getHibernateTemplate().save(globalProperty);
41     }
42
43     /**
44      * @see com.blandware.atleap.persistence.core.GlobalPropertyDAO#retrieveGlobalProperty(String)
45      */

46     public GlobalProperty retrieveGlobalProperty(String JavaDoc propertyName) {
47         return (GlobalProperty) getHibernateTemplate().get(GlobalProperty.class, propertyName);
48     }
49
50     /**
51      * @see com.blandware.atleap.persistence.core.GlobalPropertyDAO#updateGlobalProperty(com.blandware.atleap.model.core.GlobalProperty)
52      */

53     public void updateGlobalProperty(GlobalProperty globalProperty) {
54         getHibernateTemplate().update(globalProperty);
55     }
56
57     /**
58      * @see com.blandware.atleap.persistence.core.GlobalPropertyDAO#deleteGlobalProperty(com.blandware.atleap.model.core.GlobalProperty)
59      */

60     public void deleteGlobalProperty(GlobalProperty globalProperty) {
61         getHibernateTemplate().delete(globalProperty);
62     }
63
64     /**
65      * @see com.blandware.atleap.persistence.core.GlobalPropertyDAO#listDynamicProperties()
66      */

67     public List JavaDoc listDynamicProperties() {
68         String JavaDoc hql = "select p from GlobalProperty p order by p.name";
69         List JavaDoc list = executeFind(hql);
70         if ( list == null ) {
71             list = new ArrayList JavaDoc();
72         }
73         return list;
74     }
75
76 }
77
78
Popular Tags