Java 类org.hibernate.boot.spi.SessionFactoryOptions 实例源码

项目:dorset-framework    文件:HibernateServiceTest.java   
@Test
public void testCreationOfSessionFactory() {
    Properties props = getProperties();
    Config conf = ConfigFactory.parseProperties(props);

    hs = new HibernateService(conf);
    SessionFactory sf = hs.getSessionFactory();
    assertNotNull(sf);
    assertFalse(sf.isClosed());

    // traverse through the session factory to get at configuration values
    SessionFactoryOptions sfo = sf.getSessionFactoryOptions();
    StandardServiceRegistry ssr = sfo.getServiceRegistry();
    ConfigurationService cs = ssr.getService(ConfigurationService.class);
    assertEquals(props.getProperty("hibernate.connection.driver_class"), cs.getSetting("hibernate.connection.driver_class", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.connection.url"), cs.getSetting("hibernate.connection.url", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.dialect"), cs.getSetting("hibernate.dialect", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.hbm2ddl.auto"), cs.getSetting("hibernate.hbm2ddl.auto", StandardConverters.STRING));

    // check mapping
    ClassMetadata cm = sf.getClassMetadata(TestObject.class);
    String[] names = cm.getPropertyNames();
    assertEquals(1, names.length);
    assertEquals("name", names[0]);
    assertEquals("string", cm.getPropertyType("name").getName());
}
项目:dorset-framework    文件:HibernateServiceTest.java   
@Test
public void testCreationOfSessionFactory() {
    Properties props = getProperties();
    Config conf = ConfigFactory.parseProperties(props);

    hs = new HibernateService(conf);
    SessionFactory sf = hs.getSessionFactory();
    assertNotNull(sf);
    assertFalse(sf.isClosed());

    // traverse through the session factory to get at configuration values
    SessionFactoryOptions sfo = sf.getSessionFactoryOptions();
    StandardServiceRegistry ssr = sfo.getServiceRegistry();
    ConfigurationService cs = ssr.getService(ConfigurationService.class);
    assertEquals(props.getProperty("hibernate.connection.driver_class"), cs.getSetting("hibernate.connection.driver_class", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.connection.url"), cs.getSetting("hibernate.connection.url", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.dialect"), cs.getSetting("hibernate.dialect", StandardConverters.STRING));
    assertEquals(props.getProperty("hibernate.hbm2ddl.auto"), cs.getSetting("hibernate.hbm2ddl.auto", StandardConverters.STRING));

    // check mapping
    ClassMetadata cm = sf.getClassMetadata(TestObject.class);
    String[] names = cm.getPropertyNames();
    assertEquals(1, names.length);
    assertEquals("name", names[0]);
    assertEquals("string", cm.getPropertyType("name").getName());
}
项目:hibernate-ogm-ignite    文件:IgniteQueryParserServiceInitiator.java   
@Override
public QueryParserService initiateService(
        SessionFactoryImplementor sessionFactory,
        SessionFactoryOptions sessionFactoryOptions,
        ServiceRegistryImplementor registry) {
    return IgniteQueryParserService.INSTANCE;
}
项目:jhipster-ng-admin    文件:SpringCacheRegionFactory.java   
@Override
public void start(SessionFactoryOptions options, Properties properties) throws CacheException {
    // Translate the Spring URI to a real URI
    String uri = properties.getProperty(CONFIG_URI);
    Resource resource = new DefaultResourceLoader().getResource(uri);
    try {
        properties.setProperty(CONFIG_URI, resource.getURI().toString());
    }
    catch(IOException e) {
        throw new CacheException(e);
    }
    super.start(options, properties);
}
项目:hibernate-single-table-bulk-id-strategy    文件:SingleGlobalTemporaryTableBulkIdStrategy.java   
@Override
public void prepare(JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess, MetadataImplementor metadata, SessionFactoryOptions sessionFactoryOptions) {
    ConfigurationService configService = sessionFactoryOptions.getServiceRegistry().getService(ConfigurationService.class);
    this.fullyQualifiedTableName = Objects.requireNonNull(configService.getSetting(TABLE, String.class, null), "Property " + TABLE + " must be set.");
    this.idColumn = configService.getSetting(ID_COLUMN, String.class, "ID");
    this.discriminatorColumn = configService.getSetting(DISCRIMINATOR_COLUMN, String.class, "ENTITY_NAME");
    this.cleanRows = configService.getSetting(CLEAN_ROWS, StandardConverters.BOOLEAN, false);
}
项目:ignite    文件:HibernateRegionFactory.java   
/** {@inheritDoc} */
@Override public void start(SessionFactoryOptions settings, Properties props) throws CacheException {
    String accessType = props.getProperty(DFLT_ACCESS_TYPE_PROPERTY, NONSTRICT_READ_WRITE.name());

    dfltAccessType = AccessType.valueOf(accessType);

    accessStgyFactory.start(props);
}
项目:hibernate-l2-memcached    文件:MemcachedRegionFactory.java   
@Override
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException {

    this.settings = settings;
    this.properties = properties;
    log.info("Starting MemcachedClient...");
    try {
        client = getMemcachedClientFactory(wrapInConfig(properties)).createMemcacheClient();
    } catch (Exception e) {
        throw new CacheException("Unable to initialize MemcachedClient", e);
    }
}
项目:cte-multi-table-bulk-id-stategy    文件:CTEMultiTableBulkIdStrategy.java   
@Override
public void prepare(
        JdbcServices jdbcServices,
        JdbcConnectionAccess jdbcConnectionAccess,
        MetadataImplementor metadataImplementor,
        SessionFactoryOptions sessionFactoryOptions) {

}
项目:sdcct    文件:CacheRegionFactory.java   
@Override
public void start(SessionFactoryOptions settings, Properties props) throws CacheException {
    this.settings = settings;

    this.mbeanRegistrationHelper.registerMBean(this.manager, props);
}
项目:ignite    文件:CacheHibernateStoreFactorySelfTest.java   
/** {@inheritDoc} */
@Override public SessionFactoryOptions getSessionFactoryOptions() {
    return null;
}
项目:hibernate-l2-memcached    文件:MemcachedEntityRegion.java   
public MemcachedEntityRegion(MemcachedCache cache, SessionFactoryOptions settings, CacheDataDescription metadata, Config config) {
    super(cache, config);
    this.metadata = metadata;
    this.settings = settings;
}
项目:hibernate-l2-memcached    文件:MemcachedNaturalIdRegion.java   
public MemcachedNaturalIdRegion(MemcachedCache cache, SessionFactoryOptions settings, CacheDataDescription metadata, Config config) {
    super(cache, config);
    this.metadata = metadata;
    this.settings = settings;
}
项目:hibernate-l2-memcached    文件:MemcachedCollectionRegion.java   
public MemcachedCollectionRegion(MemcachedCache cache, SessionFactoryOptions settings, CacheDataDescription metadata, Config config) {
    super(cache, config);
    this.metadata = metadata;
    this.settings = settings;
}
项目:hibernate-l2-memcached    文件:ReadOnlyMemcachedEntityRegionAccessStrategy.java   
public ReadOnlyMemcachedEntityRegionAccessStrategy(MemcachedEntityRegion region, SessionFactoryOptions settings) {
    super(region, settings);
}
项目:hibernate-l2-memcached    文件:AbstractReadWriteMemcachedAccessStrategy.java   
/**
 * Creates a read/write cache access strategy around the given cache region.
 */
public AbstractReadWriteMemcachedAccessStrategy(T region, SessionFactoryOptions settings, CacheDataDescription cacheDataDescription) {
    super(region, settings);
    this.versionComparator = cacheDataDescription.getVersionComparator();
}
项目:hibernate-l2-memcached    文件:AbstractMemcachedAccessStrategy.java   
public AbstractMemcachedAccessStrategy(T region, SessionFactoryOptions settings) {
    this.region = region;
    this.settings = settings;
}
项目:hibernate-l2-memcached    文件:AbstractMemcachedAccessStrategy.java   
/**
 * The settings for this persistence unit.
 */
protected SessionFactoryOptions settings() {
    return settings;
}
项目:hibernate-l2-memcached    文件:TransactionalMemcachedEntityRegionAccessStrategy.java   
public TransactionalMemcachedEntityRegionAccessStrategy(MemcachedEntityRegion aThis, MemcachedCache cache, SessionFactoryOptions settings) {
    super(aThis, settings);
    this.cache = cache;
}
项目:hibernate-l2-memcached    文件:TransactionalMemcachedNaturalIdRegionAccessStrategy.java   
public TransactionalMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region,
                                                           SessionFactoryOptions settings) {
    super(region, settings);
}
项目:hibernate-l2-memcached    文件:NonStrictReadWriteMemcachedNaturalIdRegionAccessStrategy.java   
/**
 * Create a non-strict read/write access strategy accessing the given NaturalId region.
 */
public NonStrictReadWriteMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region, SessionFactoryOptions settings) {
    super(region, settings);
}
项目:hibernate-l2-memcached    文件:ReadOnlyMemcachedCollectionRegionAccessStrategy.java   
public ReadOnlyMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion aThis, SessionFactoryOptions settings) {
    super(aThis, settings);
}
项目:hibernate-l2-memcached    文件:ReadWriteMemcachedEntityRegionAccessStrategy.java   
public ReadWriteMemcachedEntityRegionAccessStrategy(MemcachedEntityRegion region, SessionFactoryOptions settings) {
    super(region, settings, region.getCacheDataDescription());
}
项目:hibernate-l2-memcached    文件:ReadOnlyMemcachedNaturalIdRegionAccessStrategy.java   
public ReadOnlyMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region, SessionFactoryOptions settings) {
    super(region, settings);
}
项目:hibernate-l2-memcached    文件:TransactionalMemcachedCollectionRegionAccessStrategy.java   
public TransactionalMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion region, SessionFactoryOptions settings) {
    super(region, settings);
}
项目:hibernate-l2-memcached    文件:ReadWriteMemcachedCollectionRegionAccessStrategy.java   
public ReadWriteMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion region, SessionFactoryOptions settings) {
    super(region, settings, region.getCacheDataDescription());
}
项目:hibernate-l2-memcached    文件:NonStrictReadWriteMemcachedCollectionRegionAccessStrategy.java   
public NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion region, SessionFactoryOptions settings) {
    super(region, settings);
}
项目:hibernate-l2-memcached    文件:ReadWriteMemcachedNaturalIdRegionAccessStrategy.java   
public ReadWriteMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region, SessionFactoryOptions settings, CacheDataDescription metadata) {
    super(region, settings, metadata);
}
项目:hibernate-l2-memcached    文件:NonStrictReadWriteMemcachedEntityRegionAccessStrategy.java   
/**
 * Create a non-strict read/write access strategy accessing the given collection region.
 *
 * @param region   The wrapped region
 * @param settings The Hibernate settings
 */
public NonStrictReadWriteMemcachedEntityRegionAccessStrategy(MemcachedEntityRegion region, SessionFactoryOptions settings) {
    super(region, settings);
}