Java Code Examples for org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl

The following examples show how to use org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl. These examples are extracted from open source projects. 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 Project: teiid-spring-boot   Source File: SchemaBuilderUtility.java    License: Apache License 2.0 5 votes vote down vote up
public static Metadata generateHbmModel(ConnectionProvider provider, Dialect dialect) throws SQLException {
    MetadataSources metadataSources = new MetadataSources();
    ServiceRegistry registry = metadataSources.getServiceRegistry();

    StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder(
            (BootstrapServiceRegistry) registry).applySetting(AvailableSettings.DIALECT, TeiidDialect.class)
            .addService(ConnectionProvider.class, provider).addService(JdbcEnvironment.class,
                    new JdbcEnvironmentImpl(provider.getConnection().getMetaData(), dialect))
            .build();

    MetadataBuildingOptions options = new MetadataBuildingOptionsImpl(serviceRegistry);
    BootstrapContext bootstrapContext = new BootstrapContextImpl( serviceRegistry, options );

    ReverseEngineeringStrategy strategy = new DefaultReverseEngineeringStrategy();

    InFlightMetadataCollectorImpl metadataCollector =  new InFlightMetadataCollectorImpl(bootstrapContext, options);
    MetadataBuildingContext buildingContext = new MetadataBuildingContextRootImpl(bootstrapContext, options,
            metadataCollector);

    JDBCBinder binder = new JDBCBinder(serviceRegistry, new Properties(), buildingContext, strategy, false);
    Metadata metadata = metadataCollector.buildMetadataInstance(buildingContext);
    binder.readFromDatabase(null, null, buildMapping(metadata));
    HibernateMappingExporter exporter = new HibernateMappingExporter() {
        @Override
        public Metadata getMetadata() {
            return metadata;
        }
    };
    exporter.start();
    return metadata;
}
 
Example 2
Source Project: quarkus   Source File: QuarkusJdbcEnvironmentInitiator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public JdbcEnvironment initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    return new JdbcEnvironmentImpl(registry, dialect);
}
 
Example 3
Source Project: quarkus   Source File: QuarkusNoJdbcEnvironmentInitiator.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public JdbcEnvironment initiateService(Map configurationValues, ServiceRegistryImplementor registry) {
    return new JdbcEnvironmentImpl(registry, dialect);
}