01: package com.ibatis.jpetstore.persistence;
02:
03: import java.io.Reader;
04:
05: import com.ibatis.common.resources.Resources;
06: import com.ibatis.dao.client.DaoManager;
07: import com.ibatis.dao.client.DaoManagerBuilder;
08:
09: /**
10: * <p/>Date: Mar 6, 2004 11:24:18 PM
11: *
12: * @author Clinton Begin
13: */
14: public class DaoConfig {
15:
16: private static final DaoManager daoManager;
17:
18: static {
19:
20: try {
21: String resource = "com/ibatis/jpetstore/persistence/dao.xml";
22: Reader reader = Resources.getResourceAsReader(resource);
23: daoManager = DaoManagerBuilder.buildDaoManager(reader);
24: } catch (Exception e) {
25: throw new RuntimeException(
26: "Could not initialize DaoConfig. Cause: " + e);
27: }
28: }
29:
30: public static DaoManager getDaomanager() {
31: return daoManager;
32: }
33:
34: }
|