Java – what is the difference between JPA project and EJB project in eclipse?
Which one is used?
When I want JSF stateless bean JPA entity application, do I need to integrate EJB project and dynamic web project in ear project?
Solution
EJB project is a project that focuses on the development of enterprise Java beans Usually, EJBs rely on entity beans to achieve persistence, which is implemented using JPA Technology (JPA is regarded as a dependency of EJBs)
The reason why you can choose to create JPA projects independently of EJBs is that some people may not want to use (or need) EJBs, but they still need to use ora frameworks (such as JPA) This can be, for example, a web project (i.e., JSF) that uses JPA directly for persistence (no EJB)
It should be noted that although EJB 3 uses JPA for persistence, you do not have to use EJB in your project (unless you need to do so) to benefit from ORM frameworks such as JPA
Now, to enable JPA on an EJB project in eclipse, right-click the project, go to the "project facets" option and select JPA facet By doing so, eclipse will add the required libraries, create the necessary artifacts (persistence. XML) and enable JPA related tools on the IDE