e454003a564237e0bdf7e38b3d655dafd5aa36d5
[mir.git] / source / org / codecoop / mir / core / dao / hibernate / CategoryDAO.java
1 /*
2  * Created on 28.08.2004
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Generation - Code and Comments
6  */
7 package org.codecoop.mir.core.dao.hibernate;
8
9 import net.sf.hibernate.Hibernate;
10
11 import org.codecoop.mir.core.dao.DatabaseFailure;
12 import org.codecoop.mir.core.dao.ICategoryDAO;
13 import org.codecoop.mir.core.model.Category;
14
15 /**
16  * CategoryDAO
17  * @author idefix
18  * $Id: CategoryDAO.java,v 1.1 2004/11/06 16:20:48 idfx Exp $
19  */
20 public class CategoryDAO extends AbstractDAO implements ICategoryDAO {
21
22   /* (non-Javadoc)
23    * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#getReferenceClass()
24    */
25   protected Class getReferenceClass() {
26     return Category.class;
27   }
28
29   /* (non-Javadoc)
30    * @see org.codecoop.mir.core.dao.hibernate.AbstractDAO#initializeCollections(java.lang.Object)
31    */
32   protected void initializeCollections(Object o) throws DatabaseFailure {
33     if(o instanceof Category){
34       Category c = (Category)o;
35       try {
36         Hibernate.initialize(c.getArticles());
37         Hibernate.initialize(c.getChildCategories());
38       } catch (Throwable e) {
39         throw new DatabaseFailure(e);
40       }
41     }
42   }
43
44 }