/** * It accepts both a quailified (e.g.) "lib/a.jar#FooPU" as well as * unqualified name (e.g.) "FooPU". It then searched all the * PersistenceUnits that are defined in the scope of this bundle * descriptor to see which one matches the give name. * * @param unitName as used in @PersistenceUnit, @PersistenceContext * <persistence-context-ref> or <persistence-unit-name>. * If null, this method returns the default PU, if available. * The reason it accepts null for default PU is because "" gets converted to * null in EntityManagerReferenceHandler.processNewEmRefAnnotation. * @return PersistenceUnitDescriptor that this unitName resolves to. * Returns null, if unitName could not be resolved. */ public PersistenceUnitDescriptor findReferencedPU(String unitName) { if (unitName == null || unitName.length() == 0) { // uses default PU. return findDefaultPU(); } else { return findReferencedPU0(unitName); } }
/** * It accepts both a quailified (e.g.) "lib/a.jar#FooPU" as well as * unqualified name (e.g.) "FooPU". It then searched all the * PersistenceUnits that are defined in the scope of this bundle * descriptor to see which one matches the give name. * * @param unitName as used in @PersistenceUnit, @PersistenceContext * <persistence-context-ref> or <persistence-unit-name>. * If null, this method returns the default PU, if available. * The reason it accepts null for default PU is because "" gets converted to * null in EntityManagerReferenceHandler.processNewEmRefAnnotation. * @return PersistenceUnitDescriptor that this unitName resolves to. * Returns null, if unitName could not be resolved. */ public PersistenceUnitDescriptor findReferencedPU(String unitName) { if (unitName == null || unitName.length() == 0) { // uses default PU. return findDefaultPU(); } else { return findReferencedPU0(unitName); } }