1 2 3 24 package com.geinuke.dao; 25 26 import java.io.Reader ; 27 28 import com.ibatis.common.resources.Resources; 29 import com.ibatis.sqlmap.client.SqlMapClient; 30 import com.ibatis.sqlmap.client.SqlMapClientBuilder; 31 32 public abstract class GeiDAO { 33 34 private static SqlMapClient sqlMap=null; 35 private Object lock=new Object (); 36 protected SqlMapClient sqlMap(){ 37 return sqlMap; 38 } 39 40 public GeiDAO() throws Exception { 41 synchronized(lock){ 42 try{ 43 if(sqlMap==null){ 44 Reader reader = Resources.getResourceAsReader ("SqlMapConfig.xml"); 45 47 sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); 48 } 50 }catch(Exception e){ 51 e.printStackTrace(System.out); 52 throw e; 53 } 54 } 55 } 56 57 } 58 | Popular Tags |