1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.ibatis.jpetstore.persistence;
17
18 import com.ibatis.common.resources.Resources;
19 import com.ibatis.dao.client.DaoManager;
20 import com.ibatis.dao.client.DaoManagerBuilder;
21
22 import java.io.Reader;
23
24 /***
25 * <p/>
26 * Date: Mar 6, 2004 11:24:18 PM
27 *
28 * @author Clinton Begin
29 */
30 public class DaoConfig {
31
32 private static final DaoManager daoManager;
33
34 static {
35
36 try {
37 String resource = "com/ibatis/jpetstore/persistence/dao.xml";
38 Reader reader = Resources.getResourceAsReader(resource);
39 daoManager = DaoManagerBuilder.buildDaoManager(reader);
40 } catch (Exception e) {
41 throw new RuntimeException("Could not initialize DaoConfig. Cause: " + e);
42 }
43 }
44
45 public static DaoManager getDaomanager() {
46 return daoManager;
47 }
48
49 }