下面列出了怎么用org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Find all persistence-units from all accessible {@code META-INF/persistence.xml} resources
*
* @param integration The Map of integration settings
*
* @return List of descriptors for all discovered persistence-units.
*/
public static List<ParsedPersistenceXmlDescriptor> locatePersistenceUnits(Map integration) {
final PersistenceXmlParser parser = new PersistenceXmlParser(
ClassLoaderServiceImpl.fromConfigSettings( integration ),
PersistenceUnitTransactionType.RESOURCE_LOCAL
);
parser.doResolve( integration );
return new ArrayList<>( parser.persistenceUnits.values() );
}
/**
* Generic method to parse a specified {@code persistence.xml} and return a Map of descriptors
* for all discovered persistence-units keyed by the PU name.
*
* @param persistenceXmlUrl The URL of the {@code persistence.xml} to parse
* @param transactionType The specific PersistenceUnitTransactionType to incorporate into the persistence-unit descriptor
* @param integration The Map of integration settings
*
* @return Map of persistence-unit descriptors keyed by the PU name
*/
public static Map<String, ParsedPersistenceXmlDescriptor> parse(
URL persistenceXmlUrl,
PersistenceUnitTransactionType transactionType,
Map integration) {
PersistenceXmlParser parser = new PersistenceXmlParser(
ClassLoaderServiceImpl.fromConfigSettings( integration ),
transactionType
);
parser.doResolve( integration );
return parser.persistenceUnits;
}
/**
* Constructs a BootstrapServiceRegistryImpl.
*
* Do not use directly generally speaking. Use {@link org.hibernate.boot.registry.BootstrapServiceRegistryBuilder}
* instead.
*
* @see org.hibernate.boot.registry.BootstrapServiceRegistryBuilder
*/
public BootstrapServiceRegistryImpl() {
this( new ClassLoaderServiceImpl(), NO_INTEGRATORS );
}