{
// This is currently limited to accessing the persistence units of the current project only, and not of
// dependencies (like an EJB module with a PU that is accessible on the classpath, but not in WEB-INF/lib).
PersistenceFacet persistence = project.getFacet(PersistenceFacet.class);
PersistenceDescriptor persistenceDescriptor = persistence.getConfig();
List<PersistenceUnitDef> units = persistenceDescriptor.listUnits();
// If there is only one PU, then use it irrespective of whether it excludes unlisted classes or not.
if (units.size() == 1)
{
return units.get(0).getName();