KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > demo > icare > dao > hibernate > CarHibernateDao


1 package org.objectweb.petals.demo.icare.dao.hibernate;
2
3 import java.util.Collection JavaDoc;
4
5 import org.objectweb.petals.demo.icare.dao.CarDao;
6 import org.objectweb.petals.demo.icare.model.Car;
7 import org.objectweb.petals.demo.icare.model.Category;
8 import org.objectweb.petals.demo.icare.model.Entity;
9 import org.objectweb.petals.demo.icare.model.Reservation;
10 import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
11
12 /**
13  * @author Cristian Spiescu
14  * @author Imad Zarzouri
15  * @author Omar Senhaji Rhazi
16  * @author Anass Ouazzani Chahdi
17  *
18  * @since 15.01.2007
19  */

20 public class CarHibernateDao extends HibernateDaoSupport implements CarDao {
21
22     @SuppressWarnings JavaDoc("unchecked")
23     public Collection JavaDoc<Car> loadAllCars() {
24         return getHibernateTemplate().find("from Car");
25     }
26
27     public void storeEntity(Entity e) {
28         getHibernateTemplate().saveOrUpdate(e);
29     }
30     
31     public Entity getEntityById(Class JavaDoc clazz, long id) {
32         return (Entity) getHibernateTemplate().get(clazz, id);
33     }
34
35     public void storeAllCategories(Collection JavaDoc<Category> list) {
36         getHibernateTemplate().saveOrUpdateAll(list);
37     }
38     
39     public void storeAllCars(Collection JavaDoc<Car> list) {
40         getHibernateTemplate().saveOrUpdateAll(list);
41     }
42
43     @SuppressWarnings JavaDoc("unchecked")
44     public Collection JavaDoc<Category> loadAllCategories() {
45         return getHibernateTemplate().find("from Category");
46     }
47
48     public void storeAllReservation(Collection JavaDoc<Reservation> list) {
49         getHibernateTemplate().saveOrUpdateAll(list);
50         
51     }
52
53     public Collection JavaDoc<Reservation> loadAllReservations() {
54         return getHibernateTemplate().find("from Reservation");
55     }
56 }
57
Popular Tags