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