accountssessions.java~13~

来自「一个J2EE四层架构的实例」· JAVA~13~ 代码 · 共 93 行

JAVA~13~
93
字号
package sqlaccounts;import java.awt.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */import javax.ejb.*;import javax.naming.*;import javax.rmi.PortableRemoteObject;import java.rmi.RemoteException;import java.util.Collection;import java.util.Hashtable;import java.util.Properties;import java.util.Vector;import java.util.Iterator;import javax.ejb.CreateException;import javax.ejb.DuplicateKeyException;import javax.ejb.FinderException;import javax.ejb.ObjectNotFoundException;import javax.ejb.RemoveException;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NamingException;import javax.rmi.PortableRemoteObject;public class AccountsSessions{   // private BorderLayout borderLayout1 = new BorderLayout();    private String sample = "Sample";    private String Type = "Sample";    private EjbAccountsHome ejbAccountsHome = null;    public AccountsSessions()    {        try        {            Context ctx = new InitialContext();            Object ref = ctx.lookup("EjbAccountsRemote");            this.ejbAccountsHome = (EjbAccountsHome)PortableRemoteObject.narrow(ref,EjbAccountsHome.class);        }        catch(Exception e)        {        }    }     public String getType()    {        return Type;    }    public void setType(String newType)    {        Type = newType;    }    public String getSample()   {       return sample;   }   public void setSample(String newSample)   {       sample = newSample;   }  public Vector findByType(String Type) {       try       {       Collection AllejbAccounts = ejbAccountsHome.findByType(Type);       if (AllejbAccounts.isEmpty())         return null;       Iterator it = AllejbAccounts.iterator();       Vector all=new Vector();       while (it.hasNext()){         EjbAccounts ejbAccounts = (EjbAccounts)(javax.rmi.PortableRemoteObject.narrow(it.next(),EjbAccounts.class));         all.add(new AccountsSessions(ejbAccounts.getType()));       }        return all;       }catch(Exception e){       return null;       }  }  public  AccountsSessions(String type)  {      AccountsSessions accountsSessions=new AccountsSessions();      accountsSessions.setType(type);      //return accountsSessions;  }}

⌨️ 快捷键说明

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