Example usage for org.hibernate.service.spi ServiceRegistryImplementor ServiceRegistryImplementor

List of usage examples for org.hibernate.service.spi ServiceRegistryImplementor ServiceRegistryImplementor

Introduction

In this page you can find the example usage for org.hibernate.service.spi ServiceRegistryImplementor ServiceRegistryImplementor.

Prototype

ServiceRegistryImplementor

Source Link

Usage

From source file:org.grails.orm.hibernate.support.HibernateDialectDetectorFactoryBean.java

License:Apache License

protected DialectFactory createDialectFactory() {
    DialectFactoryImpl factory = new DialectFactoryImpl();
    factory.injectServices(new ServiceRegistryImplementor() {

        @Override// w w  w  .  j  a  v  a 2 s .  c om
        public <R extends Service> R getService(Class<R> serviceRole) {
            if (serviceRole == DialectResolver.class) {
                return (R) new StandardDialectResolver();
            } else if (serviceRole == StrategySelector.class) {
                return (R) new StrategySelectorImpl(
                        new ClassLoaderServiceImpl(Thread.currentThread().getContextClassLoader()));
            }
            return null;
        }

        @Override
        public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole) {
            return null;
        }

        @Override
        public void destroy() {

        }

        @Override
        public void registerChild(ServiceRegistryImplementor child) {
        }

        @Override
        public void deRegisterChild(ServiceRegistryImplementor child) {
        }

        @Override
        public ServiceRegistry getParentServiceRegistry() {
            return null;
        }
    });
    return factory;
}