Accepted answer

JPA does not limit number of persistence units defined in persistence.xml. This warning just tells about limitation of tool in Eclipse IDE. This is told for example here :

Currently Dali only supports one Persistence Unit and one Persistence XML file per project. Other configurations can exist in a JPA project, but the validation and defaults processing may not be correct when multiple persistence units are used.

I guess there is no known way to get this work in Eclipse IDE.


While this is JPA valid, you may also turn off the resulting (annoying) error notifications on a per-project basis by going into

Project Properties => JPA => Errors/Warnings

Activate Enable project specific settings and under Type, change the notification level for Class is mapped but is not in a persistence unit from Error to anything else you're comfortable with.

Update for Eclipse Luna:

The location and name of the setting has changed in Luna. The new location is:

Project Properties => JPA => Errors/Warnings

Check Enable project specific settings

Expand Project group

Change Multiple persistence units defined: to Ignore.

enter image description here

Related Query

More Query from same tag