8. 创建 Session Bean 和 Bean Interface


  • 右击ejbModule -> New -> Session Bean (EJB 3.x)

    Eclipse + Jboss AS 7.1 创建 EJB3.0之JPA工程(下)

  • 输入包名com.ibytecode.businesslogic

  • 输入类名ProjectBean
  • 选择状态为Stateless
  • 选择Remote Business Interface并输入com.ibytecode.business.IProject
  • business interface将会在另一个包(com.ibytecode.business)中生成
  • 点击Finish

    Eclipse + Jboss AS 7.1 创建 EJB3.0之JPA工程(下)

9. 编写 Bean 和 Interface


  • 打开“Bean Interface”并且复制下面的代码
  • Interface 可以是 @Remote或者@Local。这里,我们选择@Remote (Remote 与 Local 的区别
     1 package com.ibytecode.business;
     2 import java.util.List;
     3 import javax.ejb.Remote;
     4 
     5 import com.ibytecode.entities.Project;
     6 
     7 @Remote
     8 public interface IProject {
     9     void saveProject(Project project);
    10     Project findProject(Project project);
    11     List<Project> retrieveAllProjects();
    12 }
    View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2022-01-25
  • 2022-12-23
  • 2021-12-30
  • 2021-11-10
  • 2021-09-21
相关资源
相似解决方案