国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

開發環境的配置

2019-11-18 11:22:37
字體:
來源:轉載
供稿:網友

開發時的環境配置如下:
寫一個啟動類加載和綁定hibernate的sessionfactory到weblogic下
代碼如下:
public class HibernateStartUp implements T3StartupDef {



  public static String CONFIG_FILE_PATH = "/hibernate.cfg.xml";

 public void setServices(T3ServicesDef services) {}
 public static final String SESSION_FACTORY_JNDI = "hibernate";
    public static final String URL = "t3://localhost:7001";
  public String startup(String name, Hashtable args) throws Exception {
    try {

           doBind();
           return "Hibernate Startup completed sUCcessfully";
        } catch (Exception e) {
         
       }
       return "Hibernate Startup completed successfully";
  }
  PRivate static void doBind( ) throws Exception
   {
       Properties  environment  = null;
       InitialContext  context  = null;

       try
       {
         environment = new Properties( );
         environment.put( Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
         environment.put( Context.PROVIDER_URL, URL );
         context = new InitialContext( environment );


         Configuration configuration = (new Configuration()).configure(CONFIG_FILE_PATH);
         SessionFactory factory = configuration.buildSessionFactory();
           if (factory == null)
               throw new Exception("SessionFactory cannot be built?!");

           try
           {
               if( context.lookup("hibernate")!= null )
               {
                 context.rebind("hibernate", factory);
               }


上一篇:java包機制(初稿)

下一篇:Ant指南

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 习水县| 施秉县| 锦屏县| 伊春市| 龙游县| 天门市| 香河县| 双鸭山市| 碌曲县| 波密县| 梁平县| 高雄市| 商洛市| 平江县| 灌南县| 洱源县| 增城市| 扶余县| 六盘水市| 南康市| 大埔区| 翁牛特旗| 潞西市| 开远市| 乐清市| 凯里市| 仲巴县| 那坡县| 鄂州市| 岱山县| 阿克苏市| 中卫市| 榆树市| 遵义市| 灌南县| 孝感市| 安阳县| 淳安县| 胶州市| 丹阳市| 睢宁县|