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

📄 test.java

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

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

import entity.Customer;
import entity.CustomerPK;

import service.CustomerMgmtBeanRemote;

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("CustomerMgmtBean2/remote");
//     		Customer c = new Customer();
//     		CustomerPK cpk = new CustomerPK("c2","0002");
//     		c.setAge(30);
//     		c.setCpk(cpk);
//     		cmbr.save(c);
     		
     		Customer c2 = cmbr.find(new CustomerPK("c2","0002"));
     		System.out.println(c2.getAge());
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			System.out.println(e.getMessage());
		}
	}

}

⌨️ 快捷键说明

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