This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Best practice for persistence unit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Best practice for persistence unit" Watch "Best practice for persistence unit" New topic

Best practice for persistence unit

Christian Plaetzinger

Joined: Jun 17, 2008
Posts: 1

imagine following setup:
I have multiple packages with entity beans. Currently each package contains a persistence.xml and the names of persistence units are different for each package. Each package is packed into a separate jar file. But all persistence units use the same data source and configuration.

In my opinion this doesn't make much sense. It would be easier to have only one persistence.xml containing the configuration only once and to use the same persistence unit in all packages.

What do you thing about it? For which case or for which reason would it be a good idea to have more than one persistence unit within an application?

It is sorta covered in the JavaRanch Style Guide.
subject: Best practice for persistence unit
Similar Threads
Store multiple persistence units in one entity manager factory?
Passed 1Z0-898 with 91% - some tips and study sources
Working with multiple persistence units
Accessing multiple databases with JPA
Multiple persistance unit simultaneously, issue.