Package org.hibernate.service

Examples of org.hibernate.service.ServiceRegistry


        // Fetch and pre-process the Hibernate mapping descriptors.
        loadHibernateDescriptors(hbmConfig);

        // Initialize the Hibernate session factory.
        ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder().applySettings(hbmConfig.getProperties());
        ServiceRegistry serviceRegistry = (ServiceRegistry) ReflectionUtils.invokeMethod(serviceRegistryBuilder, "buildServiceRegistry", null);
        if (serviceRegistry == null) serviceRegistry = (ServiceRegistry) ReflectionUtils.invokeMethod(serviceRegistryBuilder, "build", null);
        SessionFactory factory = hbmConfig.buildSessionFactory(serviceRegistry);
        hibernateSessionFactoryProvider.setSessionFactory(factory);

        // Set the default schema if specified via system property or via hibernate configuration.
View Full Code Here


  private AssociationTypeContext associationTypeContext;

  public OgmCollectionPersister(final Collection collection, final CollectionRegionAccessStrategy cacheAccessStrategy, final Configuration cfg, final SessionFactoryImplementor factory)
      throws MappingException, CacheException {
    super( collection, cacheAccessStrategy, cfg, factory );
    ServiceRegistry registry = factory.getServiceRegistry();
    final TypeTranslator typeTranslator = registry.getService( TypeTranslator.class );
    this.gridDialect = registry.getService( GridDialect.class );

    keyGridType = typeTranslator.getType( getKeyType() );
    elementGridType = typeTranslator.getType( getElementType() );
    indexGridType = typeTranslator.getType( getIndexType() );
    identifierGridType = typeTranslator.getType( getIdentifierType() );
View Full Code Here

    @Before
    public void setup() {
        graph = new InMemoryGraph();
        configuration = new org.hibernate.cfg.Configuration();
        configuration.configure(HIBERNATE_IN_MEM_CFG_XML);
        ServiceRegistry serviceRegistryBuilder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
        sessionManager = new HibernateSessionManager(configuration.buildSessionFactory(serviceRegistryBuilder));
        Map<?, ?> configMap = new HashMap<Object, Object>();
        Configuration lumifyConfiguration = new HashMapConfigurationLoader(configMap).createConfiguration();
        UserListenerUtil userListenerUtil = new UserListenerUtil();
        sqlUserRepository = new SqlUserRepository(lumifyConfiguration, sessionManager, authorizationRepository, userListenerUtil, graph);
View Full Code Here

                                    }
                                }
                            }
                        }

                        ServiceRegistry serviceRegistryBuilder = new StandardServiceRegistryBuilder().applySettings(hibernateConfiguration.getProperties()).build();
                        SessionFactory sessionFactory = hibernateConfiguration.buildSessionFactory(serviceRegistryBuilder);
                        return new HibernateSessionManager(sessionFactory);
                    }
                })
                .in(Scopes.SINGLETON);
View Full Code Here

    @Before
    public void setUp() throws Exception {
        graph = new InMemoryGraph();
        configuration = new org.hibernate.cfg.Configuration();
        configuration.configure(HIBERNATE_IN_MEM_CFG_XML);
        ServiceRegistry serviceRegistryBuilder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
        sessionManager = new HibernateSessionManager(configuration.buildSessionFactory(serviceRegistryBuilder));
        Map<?, ?> configMap = new HashMap<Object, Object>();
        Configuration lumifyConfiguration = new HashMapConfigurationLoader(configMap).createConfiguration();
        sqlUserRepository = new SqlUserRepository(lumifyConfiguration, sessionManager, authorizationRepository, userListenerUtil, graph);
        sqlWorkspaceRepository = new SqlWorkspaceRepository(sqlUserRepository, sessionManager, graph);
View Full Code Here

   * @deprecated Use {@link #buildSessionFactory(ServiceRegistry)} instead
   */
  public SessionFactory buildSessionFactory() throws HibernateException {
    Environment.verifyProperties( properties );
    ConfigurationHelper.resolvePlaceHolders( properties );
    final ServiceRegistry serviceRegistry =  new ServiceRegistryBuilder()
        .applySettings( properties )
        .buildServiceRegistry();
    setSessionFactoryObserver(
        new SessionFactoryObserver() {
          @Override
View Full Code Here

    this.dropSQL = configuration.generateDropSchemaScript( dialect );
    this.createSQL = configuration.generateSchemaCreationScript( dialect );
  }

  public SchemaExport(MetadataImplementor metadata) {
    ServiceRegistry serviceRegistry = metadata.getServiceRegistry();
    this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
        serviceRegistry.getService( ConnectionProvider.class )
    );
        JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
    this.sqlStatementLogger = jdbcServices.getSqlStatementLogger();
    this.formatter = ( sqlStatementLogger.isFormat() ? FormatStyle.DDL : FormatStyle.NONE ).getFormatter();
    this.sqlExceptionHelper = jdbcServices.getSqlExceptionHelper();

    this.importFiles = ConfigurationHelper.getString(
        AvailableSettings.HBM2DDL_IMPORT_FILES,
        serviceRegistry.getService( ConfigurationService.class ).getSettings(),
        DEFAULT_IMPORT_FILE
    );

    final Dialect dialect = jdbcServices.getDialect();
    this.dropSQL = metadata.getDatabase().generateDropSchemaScript( dialect );
View Full Code Here

  private final String nodeName;

  public OgmCollectionPersister(final Collection collection, final CollectionRegionAccessStrategy cacheAccessStrategy, final Configuration cfg, final SessionFactoryImplementor factory)
      throws MappingException, CacheException {
    super( collection, cacheAccessStrategy, cfg, factory );
    ServiceRegistry registry = factory.getServiceRegistry();
    final TypeTranslator typeTranslator = registry.getService( TypeTranslator.class );
    this.gridDialect = registry.getService( GridDialect.class );

    keyGridType = typeTranslator.getType( getKeyType() );
    elementGridType = typeTranslator.getType( getElementType() );
    indexGridType = typeTranslator.getType( getIndexType() );
    identifierGridType = typeTranslator.getType( getIdentifierType() );
View Full Code Here

  protected UserTransaction locateUserTransaction() {
    return new UserTransactionImpl( neo4jDb() );
  }

  private GraphDatabaseAPI neo4jDb() {
    ServiceRegistry serviceRegistry = serviceRegistry();
    serviceRegistry = serviceRegistry
        .getService( SessionFactoryServiceRegistryFactory.class )
        .buildServiceRegistry( (SessionFactoryImplementor) null, (Configuration) null );
    Neo4jDatastoreProvider service = (Neo4jDatastoreProvider) serviceRegistry.getService( DatastoreProvider.class );
    return (GraphDatabaseAPI) service.getDataBase();
  }
View Full Code Here

    protected SessionFactory buildSessionFactory() {
        Configuration conf = getHibernateConfiguration();

        BootstrapServiceRegistry bootstrapRegistry = createHibernateBootstrapServiceRegistry();

        final ServiceRegistry serviceRegistry = new ServiceRegistryBuilder(bootstrapRegistry).applySettings(
                conf.getProperties()).buildServiceRegistry();
        conf.setSessionFactoryObserver(new SessionFactoryObserver() {
            @Override
            public void sessionFactoryCreated(SessionFactory factory) {
            }
View Full Code Here

TOP

Related Classes of org.hibernate.service.ServiceRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.