Hibernate ORM Settings - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM Settings class.

This code example shows how to use the following methods: getRegionFactory
     * @param sessionFactory 
     * @return currently used <code>HazelcastInstance</code> or null if an error occurs. 
     */ 
    public static HazelcastInstance getHazelcastInstance(final SessionFactoryImplementor sessionFactory) {
        final Settings settings = sessionFactory.getSettings();
        final RegionFactory rf = settings.getRegionFactory();
        if (rf == null) {
            LOGGER.severe("Hibernate 2nd level cache has not been enabled!");
            return null; 
        } 
        if (rf instanceof AbstractHazelcastCacheRegionFactory) {
            return ((AbstractHazelcastCacheRegionFactory) rf).getHazelcastInstance();
        } else { 
            LOGGER.warning("Current 2nd level cache implementation is not HazelcastCacheRegionFactory!");
        } 
        return null; 
    } 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getCacheRegionPrefix, getRegionFactory
This code example shows how to use the following methods: getCacheRegionPrefix, getRegionFactory
		this.region = settings.getRegionFactory().buildTimestampsRegion( regionName, props ); 
	} 
    @SuppressWarnings({"UnusedDeclaration"}) 
    public UpdateTimestampsCache(Settings settings, Properties props) 
            throws HibernateException { 
        this(settings, props, null); 
    } 
 
	@SuppressWarnings({"UnnecessaryBoxing"}) 
	public void preinvalidate(Serializable[] spaces) throws CacheException { 
		readWriteLock.writeLock().lock(); 
 
		try { 
			Long ts = new Long( region.nextTimestamp() + region.getTimeout() ); 
			for ( Serializable space : spaces ) { 
	            LOG.debugf("Pre-invalidating space [%s]", space); 
				//put() has nowait semantics, is this really appropriate? 
				//note that it needs to be async replication, never local or sync 
				region.put( space, ts ); 
				if ( factory != null && factory.getStatistics().isStatisticsEnabled() ) { 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getCacheRegionPrefix, getRegionFactory
 
		this.cacheRegion = settings.getRegionFactory().buildQueryResultsRegion( regionName, props ); 
		this.updateTimestampsCache = updateTimestampsCache; 
	} 
 
	@SuppressWarnings({ "UnnecessaryBoxing", "unchecked" }) 
	public boolean put( 
			QueryKey key, 
			Type[] returnTypes, 
			List result, 
			boolean isNaturalKeyLookup, 
			SessionImplementor session) throws HibernateException { 
        if (isNaturalKeyLookup && result.size() == 0) return false; 
        Long ts = new Long(session.getFactory().getSettings().getRegionFactory().nextTimestamp()); 
 
        LOG.debugf("Caching query results in region: %s; timestamp=%s", cacheRegion.getName(), ts); 
 
		List cacheable = new ArrayList(result.size() + 1); 
        logCachedResultDetails(key, null, returnTypes, cacheable); 
        cacheable.add(ts); 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isMinimalPutsEnabled
	 * 
	 * @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object) 
	 * @see org.hibernate.cache.spi.access.CollectionRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object) 
	 */ 
	public final boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
		return putFromLoad( key, value, txTimestamp, version, settings.isMinimalPutsEnabled() );
	} 
 
	/** 
	 * This method is a placeholder for method signatures supplied by interfaces pulled in further down the class 
	 * hierarchy. 
	 * 
	 * @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object, boolean) 
	 * @see org.hibernate.cache.spi.access.CollectionRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object, boolean) 
	 */ 
	public abstract boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
			throws CacheException;
 
	/** 
	 * Region locks are not supported. 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE