BEA WebLogic Server 7 Manual do Utilizador Página 27

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
Vista de página 26
EJB
Development Using Borland
®
JBuilder
®
8 and BEA WebLogic Server
7.0
27
Figure 16: Visual EJBs in JBuilder displaying the fields and methods of entity and session
beans
Open EmployeeSesBean.java in the editor pane ( right-click EmployeeSes and click View
bean source) and change the getEmpName(Short empNo) method as follows”
public String getEmpName(Short empNo) {
String empName = "name not found";
try {
javax.naming.Context context = new
javax.naming.InitialContext();
Object object = context.lookup("java:comp/env/ejb/Employee");
EmployeeHome empHome = (EmployeeHome)
javax.rmi.PortableRemoteObject.narrow(object, EmployeeHome.class);
Employee emp = empHome.findByPrimaryKey(empNo);
empName = emp.getFirstName() + " " + emp.getLastName();
}catch (NamingException ex) {
ex.printStackTrace();
}catch (ClassCastException ex) {
Vista de página 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 62 63

Comentários a estes Manuais

Sem comentários