Let's now create the Course Management application that we created in Chapter 4, Creating JEE Database Applications, this time using EJBs. In Chapter 4, Creating JEE Database Applications, we created service classes (which were POJOs) for writing the business logic. We will replace them with EJBs. We will start by creating Eclipse projects for EJBs.
EJBs are packaged in a JAR file. Web applications are packaged in a Web Application aRchive (WAR). If EJBs are to be accessed remotely, then the client needs to have access to business interfaces. Therefore, EJB business interfaces and shared objects are packaged in a separate JAR, called EJB client JAR. Furthermore, if EJBs and web applications are to be deployed as one single application, then they need to be packaged in an EAR.
So, in most cases the application with EJBs is not a single project, but four different projects:
- EJB project that creates EJB JAR
- EJB client...