How to model Persistence Units
Java Persistence API (JPA) defines so called persistence units. They are used to put a bunch of persistence objects together. All persistent classes within the same persistence unit share the same database connection and transaction.
As mentioned in section about modelling of persistent objects its not sufficient to only model persistent classes and their attributes and associations. In addition also persistence units have to be defined.
As you can see in the diagram above persistence units have to be model as components that are tagged with stereotype «PersistenceUnit»
. In addition it is required to define which classes should belong to the persistence unit. Therefore dependencies to all packages that contain the persistent classes of the persistence unit need to be added to the model.
For further information please also refer to: