KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibatis > jpetstore > persistence > DaoConfig


1 package com.ibatis.jpetstore.persistence;
2
3 import com.ibatis.common.resources.Resources;
4 import com.ibatis.dao.client.DaoManager;
5 import com.ibatis.dao.client.DaoManagerBuilder;
6
7 import java.io.Reader JavaDoc;
8
9 /**
10  * <p/>
11  * Date: Mar 6, 2004 11:24:18 PM
12  *
13  * @author Clinton Begin
14  */

15 public class DaoConfig {
16
17   private static final DaoManager daoManager;
18
19   static {
20
21     try {
22       String JavaDoc resource = "com/ibatis/jpetstore/persistence/dao.xml";
23       Reader JavaDoc reader = Resources.getResourceAsReader(resource);
24       daoManager = DaoManagerBuilder.buildDaoManager(reader);
25     } catch (Exception JavaDoc e) {
26       throw new RuntimeException JavaDoc("Could not initialize DaoConfig. Cause: " + e);
27     }
28   }
29
30   public static DaoManager getDaomanager() {
31     return daoManager;
32   }
33
34 }
35
Popular Tags