本文整理匯總了Java中org.hibernate.service.ServiceRegistry.getService方法的典型用法代碼示例。如果您正苦於以下問題:Java ServiceRegistry.getService方法的具體用法?Java ServiceRegistry.getService怎麽用?Java ServiceRegistry.getService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.hibernate.service.ServiceRegistry
的用法示例。
在下文中一共展示了ServiceRegistry.getService方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SchemaExport
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
public SchemaExport(ServiceRegistry serviceRegistry, Configuration configuration) {
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
serviceRegistry.getService( ConnectionProvider.class )
);
this.sqlStatementLogger = serviceRegistry.getService( JdbcServices.class ).getSqlStatementLogger();
this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
this.sqlExceptionHelper = serviceRegistry.getService( JdbcServices.class ).getSqlExceptionHelper();
this.importFiles = ConfigurationHelper.getString(
AvailableSettings.HBM2DDL_IMPORT_FILES,
configuration.getProperties(),
DEFAULT_IMPORT_FILE
);
final Dialect dialect = serviceRegistry.getService( JdbcServices.class ).getDialect();
this.dropSQL = configuration.generateDropSchemaScript( dialect );
this.createSQL = configuration.generateSchemaCreationScript( dialect );
}
示例2: createEntityCopyObserver
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
private EntityCopyObserver createEntityCopyObserver(SessionFactoryImplementor sessionFactory) {
final ServiceRegistry serviceRegistry = sessionFactory.getServiceRegistry();
if ( entityCopyObserverStrategy == null ) {
final ConfigurationService configurationService
= serviceRegistry.getService( ConfigurationService.class );
entityCopyObserverStrategy = configurationService.getSetting(
"hibernate.event.merge.entity_copy_observer",
new ConfigurationService.Converter<String>() {
@Override
public String convert(Object value) {
return value.toString();
}
},
EntityCopyNotAllowedObserver.SHORT_NAME
);
LOG.debugf( "EntityCopyObserver strategy: %s", entityCopyObserverStrategy );
}
final StrategySelector strategySelector = serviceRegistry.getService( StrategySelector.class );
return strategySelector.resolveStrategy( EntityCopyObserver.class, entityCopyObserverStrategy );
}
示例3: classForName
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
public static Class classForName(String className, ServiceRegistry serviceRegistry) {
ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
try {
return classLoaderService.classForName( className );
}
catch ( ClassLoadingException e ) {
throw new MappingException( "Could not find class: " + className );
}
}
示例4: getUpdateSource
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
@Override
public SynchronizedUpdateSource getUpdateSource(
ExtendedSearchIntegrator searchIntegrator,
Map<Class<?>, RehashedTypeMetadata> rehashedTypeMetadataPerIndexRoot,
Map<Class<?>, List<Class<?>>> containedInIndexOf,
Properties properties,
EntityManagerFactory emf,
TransactionManager transactionManager,
Set<Class<?>> indexRelevantEntities) {
HibernateEntityManagerFactory hibernateEntityManagerFactory =
(HibernateEntityManagerFactory) emf;
SessionFactoryImpl sessionFactory = (SessionFactoryImpl) hibernateEntityManagerFactory.getSessionFactory();
ServiceRegistry serviceRegistry = sessionFactory.getServiceRegistry();
EventListenerRegistry listenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
HibernateUpdateSource updateSource = new HibernateUpdateSource();
updateSource.initialize( searchIntegrator );
listenerRegistry.addDuplicationStrategy( new DuplicationStrategyImpl( HibernateUpdateSource.class ) );
listenerRegistry.appendListeners( EventType.POST_INSERT, updateSource );
listenerRegistry.appendListeners( EventType.POST_UPDATE, updateSource );
listenerRegistry.appendListeners( EventType.POST_DELETE, updateSource );
listenerRegistry.appendListeners( EventType.POST_COLLECTION_RECREATE, updateSource );
listenerRegistry.appendListeners( EventType.POST_COLLECTION_REMOVE, updateSource );
listenerRegistry.appendListeners( EventType.POST_COLLECTION_UPDATE, updateSource );
return updateSource;
}
開發者ID:Hotware,項目名稱:Hibernate-Search-GenericJPA,代碼行數:30,代碼來源:HibernateSynchronizedUpdateSourceProvider.java
示例5: DbOpenHelper
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
public DbOpenHelper(ServiceRegistry serviceRegistry) throws HibernateException {
final JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
connectionHelper = new SuppliedConnectionProviderConnectionHelper(jdbcServices.getConnectionProvider());
sqlStatementLogger = jdbcServices.getSqlStatementLogger();
formatter = (sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE).getFormatter();
}
示例6: SchemaUpdate
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
public SchemaUpdate(ServiceRegistry serviceRegistry, Configuration cfg) throws HibernateException {
this.configuration = cfg;
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
this.dialect = jdbcServices.getDialect();
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper( jdbcServices.getConnectionProvider() );
this.sqlExceptionHelper = new SqlExceptionHelper();
this.sqlStatementLogger = jdbcServices.getSqlStatementLogger();
this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
}
示例7: SchemaValidator
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
public SchemaValidator(ServiceRegistry serviceRegistry, Configuration cfg ) throws HibernateException {
this.configuration = cfg;
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
this.dialect = jdbcServices.getDialect();
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper( jdbcServices.getConnectionProvider() );
}
示例8: testEventInjection
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
/**
* Test the application event injectors.
*/
@Test
public void testEventInjection() {
// Create a fake application.
SessionFactory factoryFactory = locator
.getService(SessionFactory.class);
Assert.assertNotNull(factoryFactory);
ServiceRegistry serviceRegistry = ((SessionFactoryImpl) factoryFactory)
.getServiceRegistry();
EventListenerRegistry eventRegistry = serviceRegistry
.getService(EventListenerRegistry.class);
EventListenerGroup<PreInsertEventListener> priGroup = eventRegistry
.getEventListenerGroup(EventType.PRE_INSERT);
assertContainsListener(priGroup);
EventListenerGroup<PostInsertEventListener> poiGroup = eventRegistry
.getEventListenerGroup(EventType.POST_INSERT);
assertContainsListener(poiGroup);
EventListenerGroup<PreUpdateEventListener> pruGroup = eventRegistry
.getEventListenerGroup(EventType.PRE_UPDATE);
assertContainsListener(pruGroup);
EventListenerGroup<PostUpdateEventListener> pouGroup = eventRegistry
.getEventListenerGroup(EventType.POST_UPDATE);
assertContainsListener(pouGroup);
EventListenerGroup<PreDeleteEventListener> prdGroup = eventRegistry
.getEventListenerGroup(EventType.PRE_DELETE);
assertContainsListener(prdGroup);
EventListenerGroup<PostDeleteEventListener> podGroup = eventRegistry
.getEventListenerGroup(EventType.POST_DELETE);
assertContainsListener(podGroup);
EventListenerGroup<PostInsertEventListener> pciGroup = eventRegistry
.getEventListenerGroup(EventType.POST_COMMIT_INSERT);
assertContainsListener(pciGroup);
EventListenerGroup<PostUpdateEventListener> pcuGroup = eventRegistry
.getEventListenerGroup(EventType.POST_COMMIT_UPDATE);
assertContainsListener(pcuGroup);
EventListenerGroup<PostDeleteEventListener> pcdGroup = eventRegistry
.getEventListenerGroup(EventType.POST_COMMIT_DELETE);
assertContainsListener(pcdGroup);
}
示例9: HibernateDatabaseConnection
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
public HibernateDatabaseConnection(final ServiceRegistry registry, String schema)
{
this.connectionProvider = registry.getService(ConnectionProvider.class);
this.schema = schema;
}
示例10: configure
import org.hibernate.service.ServiceRegistry; //導入方法依賴的package包/類
@Override
public void configure(
Type type, Properties params, ServiceRegistry serviceRegistry)
throws MappingException {
final JdbcEnvironment jdbcEnvironment =
serviceRegistry.getService(JdbcEnvironment.class);
final Dialect dialect = jdbcEnvironment.getDialect();
final ConfigurationService configurationService =
serviceRegistry.getService(ConfigurationService.class);
String globalEntityIdentifierPrefix =
configurationService.getSetting( "entity.identifier.prefix", String.class, "SEQ_" );
sequencePrefix = ConfigurationHelper.getString(
SEQUENCE_PREFIX,
params,
globalEntityIdentifierPrefix);
final String sequencePerEntitySuffix = ConfigurationHelper.getString(
SequenceStyleGenerator.CONFIG_SEQUENCE_PER_ENTITY_SUFFIX,
params,
SequenceStyleGenerator.DEF_SEQUENCE_SUFFIX);
final String defaultSequenceName = ConfigurationHelper.getBoolean(
SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY,
params,
false)
? params.getProperty(JPA_ENTITY_NAME) + sequencePerEntitySuffix
: SequenceStyleGenerator.DEF_SEQUENCE_NAME;
sequenceCallSyntax = dialect.getSequenceNextValString(
ConfigurationHelper.getString(
SequenceStyleGenerator.SEQUENCE_PARAM,
params,
defaultSequenceName));
}
開發者ID:vladmihalcea,項目名稱:high-performance-java-persistence,代碼行數:37,代碼來源:StringSequenceIdentifier.java