@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()); }
@Override public QueryParserService initiateService( SessionFactoryImplementor sessionFactory, SessionFactoryOptions sessionFactoryOptions, ServiceRegistryImplementor registry) { return IgniteQueryParserService.INSTANCE; }
@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); }
@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); }
/** {@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); }
@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); } }
@Override public void prepare( JdbcServices jdbcServices, JdbcConnectionAccess jdbcConnectionAccess, MetadataImplementor metadataImplementor, SessionFactoryOptions sessionFactoryOptions) { }
@Override public void start(SessionFactoryOptions settings, Properties props) throws CacheException { this.settings = settings; this.mbeanRegistrationHelper.registerMBean(this.manager, props); }
/** {@inheritDoc} */ @Override public SessionFactoryOptions getSessionFactoryOptions() { return null; }
public MemcachedEntityRegion(MemcachedCache cache, SessionFactoryOptions settings, CacheDataDescription metadata, Config config) { super(cache, config); this.metadata = metadata; this.settings = settings; }
public MemcachedNaturalIdRegion(MemcachedCache cache, SessionFactoryOptions settings, CacheDataDescription metadata, Config config) { super(cache, config); this.metadata = metadata; this.settings = settings; }
public MemcachedCollectionRegion(MemcachedCache cache, SessionFactoryOptions settings, CacheDataDescription metadata, Config config) { super(cache, config); this.metadata = metadata; this.settings = settings; }
public ReadOnlyMemcachedEntityRegionAccessStrategy(MemcachedEntityRegion region, SessionFactoryOptions settings) { super(region, settings); }
/** * 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(); }
public AbstractMemcachedAccessStrategy(T region, SessionFactoryOptions settings) { this.region = region; this.settings = settings; }
/** * The settings for this persistence unit. */ protected SessionFactoryOptions settings() { return settings; }
public TransactionalMemcachedEntityRegionAccessStrategy(MemcachedEntityRegion aThis, MemcachedCache cache, SessionFactoryOptions settings) { super(aThis, settings); this.cache = cache; }
public TransactionalMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region, SessionFactoryOptions settings) { super(region, settings); }
/** * Create a non-strict read/write access strategy accessing the given NaturalId region. */ public NonStrictReadWriteMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region, SessionFactoryOptions settings) { super(region, settings); }
public ReadOnlyMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion aThis, SessionFactoryOptions settings) { super(aThis, settings); }
public ReadWriteMemcachedEntityRegionAccessStrategy(MemcachedEntityRegion region, SessionFactoryOptions settings) { super(region, settings, region.getCacheDataDescription()); }
public ReadOnlyMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region, SessionFactoryOptions settings) { super(region, settings); }
public TransactionalMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion region, SessionFactoryOptions settings) { super(region, settings); }
public ReadWriteMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion region, SessionFactoryOptions settings) { super(region, settings, region.getCacheDataDescription()); }
public NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(MemcachedCollectionRegion region, SessionFactoryOptions settings) { super(region, settings); }
public ReadWriteMemcachedNaturalIdRegionAccessStrategy(MemcachedNaturalIdRegion region, SessionFactoryOptions settings, CacheDataDescription metadata) { super(region, settings, metadata); }
/** * 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); }