Sunday, October 29, 2006

Persistence Unit or Persistence Context?

Which to use for a particular application depends entirely on the environment, or preference.

  • @PersistenceUnit annotation is used in J5SE applications to handle Java Persistence API (JPA) persistence management. You may use a PeristenceUnit in an application inside a container, but it must be managed by the developer instead of the container.
  • @PersistenceContext annotation is used for Container Managed Persistence (CMP). This relieves the developer of having to worry about connection management.

3 comments :

Popular Posts