# Summary

The purpose of this assignment is to implement a foundation EJB service layer and explore generic types.
分配的目的是实现基础 EJB 服务层并探索通用类型。

# Requirements

# Documentation

You can take a break from the wiki this week.  No docs required for this lab.

# Database Setup

Use your itmd4515 database and user from Lab 2 - Setup and Introductory Webapp.

# Project Setup

Your uid-fp repository should already be setup, and you should continue pushing your commits into GitHub for this lab.
您的 uid-fp 信息库应该已经设置好,并且您应该继续将提交提交到 GitHub 中以进行本实验。

Deviating from the package convention given above will mean that you can not benefit from Sonar and other automated tools, and I will not be able to fix this. Please follow the specification!

# Project Requirements

You should add these changes to your uid-fp project.
您应该将这些更改添加到 uid-fp 项目中。

Make sure you are following standard Java naming conventions. Please review the following if you are not sure what those naming conventions are:

  • Java 8 Pocket Guide by Patricia Liguori, Robert Liguori - Chapter 1. Naming Conventions
  • Code Conventions for the Java Programming Language - 9 Naming Conventions (dated, but still correct)
  1. As demonstrated in class, create  @Stateless EJB components to function as your service layer
    创建 @Stateless EJB 组件以充当您的服务层

    • Your @Stateless EJB components must implement all database operations (i.e. CRUD) for your domain model.  You must use JPA for these operations, do not use JDBC.
      您的 @Stateless EJB 组件必须为您的域模型实现所有数据库操作(即 CRUD)。您必须将 JPA 用于这些操作,而不要使用 JDBC。
    • Obtain an EntityManager using Resource Injection (@PersistenceContext).
      使用资源注入( @PersistenceContext )获得 EntityManager。
    • You may follow whatever design pattern you wish, but if you chose to follow the pattern discussed in class this might involve an abstract BaseService and then a service-class-per-entity to implement specific functionality for that entity.
      您可以遵循所需的任何设计模式,但是如果选择遵循在课堂上讨论的模式,则可能涉及到抽象 BaseService,然后是每个实体的服务类,以实现该实体的特定功能。
  2. As demonstrated in class, create a Startup Singleton EJB to seed your database with sample data.  You must invoke the CRUD methods in your Stateless EJB components from above.  Do not use the EntityManager directly in the Startup Singleton EJB.  In this way, we will be exercising the code we have written.  Include a section that writes output for all your sample data using a Logger - including navigating your relationships.
    如在课堂上所演示的,创建一个 Startup Singleton EJB 来为您的数据库提供样本数据。您必须从上面在无状态 EJB 组件中调用 CRUD 方法。不要直接在 Startup Singleton EJB 中使用 EntityManager。这样,我们将行使我们编写的代码。 包括一个部分,该部分使用 Logger 记录所有示例数据的输出 - 包括关系。

  3. Please feel free to use Sonar to analyze your code before submitting.  I have created Sonar projects for everyone.
    在提交之前,请随时使用 Sonar 分析您的代码。

  4. Submit to Blackboard

    1. Right your uid-fp project and select "Clean"
    2. Go to your NetBeans Projects directory.  Create a zip file of the uid-fp folder and submit it to the Blackboard assignment.