使用NetWeaver开发EJB3.0

简介:

Prerequisites

The  Windows   ®  Open Perspective  ®  Other  ®  J2EE  perspective is open.

Procedure

Creating the EJB Module Project

You develop the EJB 3.0 classes in an EJB 3.0 project in the J2EE perspective.
...
       1.       Choose File   ®  New   ®  Project from the main menu.
       2.       Select the EJB Project 3.0 wizard by choosing EJB   ®  EJB Project 3.0 on the New Project screen.
       3.       Choose Next to proceed to the Create an EJB 3.0 Project screen.
       4.       Enter  ConverterEJB  in the Project Name field.
       5.       Leave the Create project in the workspace for the Location of the project.
       6.       To assign the EJB project to an Enterprise Application project, choose Add project to an EAR and enter  ConverterEAR  in EAR Project Name field.
The ConverterEAR project is created automatically when you complete the wizard.
 
       7.       Choose Finish to create your EJB 3.0 project.

Creating the Stateless Session Bean

...
       1.       From the context menu of the ejbModule node of the ConverterEJB project choose New   ®  Other.
       2.       Choose EJB   ®  EJB Session Bean 3.0 on the New screen.
       3.       Choose Next.
       4.       Enter ConverterBean in the EJB Name field and com.sap.tutorial.javaee in the Default EJBPackage field.
       5.       Select the Stateless radio button for Session Type.
       6.       Deselect the Remote checkbox for Create Interface.
       7.       Choose Finish.
       8.       Implement the business logic of  ConverterBean  by entering the following code in its body:
private  BigDecimal dollarRate =  new  BigDecimal( "1.2" );
private  BigDecimal euroRate =  new  BigDecimal( "0.83" );
 
public  BigDecimal dollarToEuro(BigDecimal dollars) {
  BigDecimal result = dollars.multiply(euroRate);
   return  result.setScale(2, BigDecimal.ROUND_UP);
  }
         
public  BigDecimal euroToDollar(BigDecimal euros) {
  BigDecimal result = euros.multiply(dollarRate);
   return  result.setScale(2, BigDecimal.ROUND_UP);
  }
       9.       To import the additional classes that you refer in your code, choose Source   ®  Organize Imports from the main menu.
   10.       To add the  dollarToEuro  business method to the bean’s local interface, locate the  Outline  view and from the context menu of the method choose  EJB Methods    ®   Add to Local Interfaces .
Repeat the same step to add the  euroToDollar  method to the local interface as well.
   11.       Choose File  ®  Save from the main menu to save the bean.









本文转自 牛海彬 51CTO博客,原文链接:http://blog.51cto.com/newhappy/77027,如需转载请自行联系原作者
目录
相关文章
|
6月前
|
存储 前端开发 搜索推荐
关于 SAP Enterprise Portal 的前后端技术栈
关于 SAP Enterprise Portal 的前后端技术栈
52 0
|
6月前
|
自然语言处理 运维 JavaScript
SAP BTP 平台 CloudFoundry 环境下编程概述
SAP BTP 平台 CloudFoundry 环境下编程概述
87 0
|
7月前
|
Kubernetes 应用服务中间件 API
SAP BTP 的 ABAP Environment 和 CloudFoundry 环境的关系
SAP BTP 的 ABAP Environment 和 CloudFoundry 环境的关系
57 0
|
7月前
|
Java API Maven
如何将 SAP Business Application Studio 里开发的 Java 应用部署到 SAP BTP 上
如何将 SAP Business Application Studio 里开发的 Java 应用部署到 SAP BTP 上
70 0
|
9月前
|
开发框架 Java 中间件
【中间件】——EJB学习总结
公共服务框架:支持大量的、由应用服务器提供的系统级服务
|
Java API Maven
如何将 SAP Business Application Studio 里开发的 Java 应用部署到 SAP BTP 上
如何将 SAP Business Application Studio 里开发的 Java 应用部署到 SAP BTP 上
117 0
如何将 SAP Business Application Studio 里开发的 Java 应用部署到 SAP BTP 上
|
存储 前端开发 JavaScript
金庸和古龙,Netweaver和微服务,以及SAP Hybris Revenue Cloud
金庸和古龙,Netweaver和微服务,以及SAP Hybris Revenue Cloud
89 0
|
JSON 安全 Java
在SAP云平台的CloudFoundry环境下消费ABAP On-Premise OData服务
在SAP云平台的CloudFoundry环境下消费ABAP On-Premise OData服务
116 0
在SAP云平台的CloudFoundry环境下消费ABAP On-Premise OData服务
|
XML 前端开发 Java
SAP Hybris MVC里的M指什么
SAP Hybris MVC里的M指什么
90 0
SAP Hybris MVC里的M指什么