⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sessionbeanfactory.java

📁 客户管理系统,很强大的功能,能完成日常生活中的大部分事务
💻 JAVA
字号:
package custom_management;

import javax.naming.Context;
import javax.rmi.PortableRemoteObject;

public class SessionBeanFactory {
  //会话Bean的远程接口
  private static CustomerManageSession   CustomerManageSession = null;
  //静态方法,获得beanJndiName指定的会话Bean远程接口
   public static  CustomerManageSession getCustomerManageSessionBean(String beanJndiName) {
       if (CustomerManageSession != null)
           return CustomerManageSession;

       try {
           Context ctx = BuilderContext.getWeblogicServerInitialContext();
           Object ref = ctx.lookup(beanJndiName);
           //look up jndi name and cast to Home interface
           CustomerManageSessionHome CustomerManageSessionHome = (CustomerManageSessionHome)
                                                     PortableRemoteObject.
                                                     narrow(ref,
                   CustomerManageSessionHome.class);
          CustomerManageSession = CustomerManageSessionHome.create();
          return CustomerManageSession;
       } catch (Exception ex) {
           ex.printStackTrace();
           return null;
       }
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -