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

📄 test.java

📁 ejb学习资料
💻 JAVA
字号:
package test;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import service.CustomerMgmtBeanRemote;
import entity.Customer;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
     	try {
     		Context ctx = new InitialContext();
     		CustomerMgmtBeanRemote cmbr = 
     			(CustomerMgmtBeanRemote) ctx.lookup("CustomerMgmtBean3/remote");
     		Customer c = new Customer();
     		c.setName("c1");
     		c.setCity("bj");
     		c.setStreet("ca");
     		cmbr.save(c);
     		
     		Customer c2 = cmbr.find("c1");
     		System.out.println(c2.getCity());
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
	}

}

⌨️ 快捷键说明

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