org.hibernate.boot.spi.SessionFactoryBuilderFactory Java Examples
The following examples show how to use
org.hibernate.boot.spi.SessionFactoryBuilderFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetadataImpl.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public SessionFactoryBuilder getSessionFactoryBuilder() { final SessionFactoryBuilderImpl defaultBuilder = new SessionFactoryBuilderImpl( this, bootstrapContext ); final ClassLoaderService cls = metadataBuildingOptions.getServiceRegistry().getService( ClassLoaderService.class ); final java.util.Collection<SessionFactoryBuilderFactory> discoveredBuilderFactories = cls.loadJavaServices( SessionFactoryBuilderFactory.class ); SessionFactoryBuilder builder = null; List<String> activeFactoryNames = null; for ( SessionFactoryBuilderFactory discoveredBuilderFactory : discoveredBuilderFactories ) { final SessionFactoryBuilder returnedBuilder = discoveredBuilderFactory.getSessionFactoryBuilder( this, defaultBuilder ); if ( returnedBuilder != null ) { if ( activeFactoryNames == null ) { activeFactoryNames = new ArrayList<>(); } activeFactoryNames.add( discoveredBuilderFactory.getClass().getName() ); builder = returnedBuilder; } } if ( activeFactoryNames != null && activeFactoryNames.size() > 1 ) { throw new HibernateException( "Multiple active SessionFactoryBuilderFactory definitions were discovered : " + String.join(", ", activeFactoryNames) ); } if ( builder != null ) { return builder; } return defaultBuilder; }