private static String defaultPersistenceUnitName ( String persistenceUnitName , PersistenceUnitMetadataHolder holder ) { if ( ( persistenceUnitName == null || persistenceUnitName . length ( ) == 0 ) ) { for ( PersistenceUnitMetadata persistenceUnit : holder . getPersistenceUnits ( ) ) { String defaultPU = persistenceUnit . getProperties ( ) . getProperty ( Configuration . JPA_DEFAULT_PERSISTENCE_UNIT ) ; if ( Boolean . TRUE . toString ( ) . equals ( defaultPU ) ) { persistenceUnitName = persistenceUnit . getPersistenceUnitName ( ) ; } } } return persistenceUnitName ; }
if no persistence unit name is specified return name of default persistence unit