Packages and entities

See now what we need to use JPA in our applications. Entities can be used in all applications such as web, EJB, or simply Contexts and Dependency Injection (CDI). Because CDI is included in web and EJB application, we can deduce that the minimum configuration for a JPA applications is CDI. Here is a sample of a JAR--deployable package:

common-test.jar     Entity classes....     META-INF          beans.xml          persistence.xml

The beans.xml in our case is mandatory but it can be empty. The important configuration file in the persistence is the persistence.xml. It contains all information about connections and transactions useful to establish the connection with the database. In WildFly you can add the Hibernate properties too useful for getting ...

Get Mastering Java EE Development with WildFly now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.