testclient.java

来自「Jboss s J2EE Sample」· Java 代码 · 共 34 行

JAVA
34
字号
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package test.client;

import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject; 

import test.interfaces.TestSession;
import test.interfaces.TestSessionHome;

public class TestClient {

   public static void main(String[] args){
      try {
         InitialContext lContext = new InitialContext();
         
         TestSessionHome lHome = (TestSessionHome) lContext.lookup( "ejb/test/TestSession" );
         TestSession lSession = lHome.create();
         // Get a new Id of the Test Entity
         int lId = lSession.getNewEntityId();
         System.out.println( "New Entity Id is: " + lId );
         
         lSession.remove();
      } catch( Exception e ){
         e.printStackTrace();
      }
   }

}

⌨️ 快捷键说明

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