List of usage examples for org.hibernate.cfg AvailableSettings GENERATE_STATISTICS
String GENERATE_STATISTICS
To view the source code for org.hibernate.cfg AvailableSettings GENERATE_STATISTICS.
Click Source Link
From source file:com.astonish.dropwizard.routing.hibernate.RoutingSessionFactoryFactory.java
License:Apache License
/** * Builds a {@link SessionFactory}/*w w w. j a va 2s.co m*/ * @param bundle * the bundle * @param dbConfig * the dbconfig * @param connectionProvider * the connection provider * @param properties * the hibernate properties * @param entities * the persistent entities * @return {@link SessionFactory} */ private SessionFactory buildSessionFactory(RoutingHibernateBundle<?> bundle, DataSourceFactory dbConfig, ConnectionProvider connectionProvider, Map<String, String> properties, List<Class<?>> entities) { final Configuration configuration = new Configuration(); configuration.setProperty(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, "managed"); configuration.setProperty(AvailableSettings.USE_SQL_COMMENTS, Boolean.toString(dbConfig.isAutoCommentsEnabled())); configuration.setProperty(AvailableSettings.USE_GET_GENERATED_KEYS, "true"); configuration.setProperty(AvailableSettings.GENERATE_STATISTICS, "true"); configuration.setProperty(AvailableSettings.USE_REFLECTION_OPTIMIZER, "true"); configuration.setProperty(AvailableSettings.ORDER_UPDATES, "true"); configuration.setProperty(AvailableSettings.ORDER_INSERTS, "true"); configuration.setProperty(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true"); configuration.setProperty("jadira.usertype.autoRegisterUserTypes", "true"); for (Map.Entry<String, String> property : properties.entrySet()) { configuration.setProperty(property.getKey(), property.getValue()); } addAnnotatedClasses(configuration, entities); bundle.configure(configuration); final ServiceRegistry registry = new StandardServiceRegistryBuilder() .addService(ConnectionProvider.class, connectionProvider).applySettings(properties).build(); return configuration.buildSessionFactory(registry); }
From source file:com.yahoo.elide.contrib.dropwizard.elide.SessionFactoryFactory.java
License:Apache License
private SessionFactory buildSessionFactory(ElideBundle<?> bundle, PooledDataSourceFactory dbConfig, ConnectionProvider connectionProvider, Map<String, String> properties, List<Class<?>> entities) { final Configuration configuration = new Configuration(); configuration.setProperty(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, "managed"); configuration.setProperty(AvailableSettings.USE_SQL_COMMENTS, Boolean.toString(dbConfig.isAutoCommentsEnabled())); configuration.setProperty(AvailableSettings.USE_GET_GENERATED_KEYS, "true"); configuration.setProperty(AvailableSettings.GENERATE_STATISTICS, "true"); configuration.setProperty(AvailableSettings.USE_REFLECTION_OPTIMIZER, "true"); configuration.setProperty(AvailableSettings.ORDER_UPDATES, "true"); configuration.setProperty(AvailableSettings.ORDER_INSERTS, "true"); configuration.setProperty(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true"); configuration.setProperty("jadira.usertype.autoRegisterUserTypes", "true"); for (Map.Entry<String, String> property : properties.entrySet()) { configuration.setProperty(property.getKey(), property.getValue()); }/*w w w .j a v a 2 s .c o m*/ addAnnotatedClasses(configuration, entities); bundle.configure(configuration); final ServiceRegistry registry = new StandardServiceRegistryBuilder() .addService(ConnectionProvider.class, connectionProvider) .applySettings(configuration.getProperties()).build(); configure(configuration, registry); return configuration.buildSessionFactory(registry); }
From source file:org.infinispan.test.hibernate.cache.commons.util.CacheTestUtil.java
License:LGPL
@SuppressWarnings("unchecked") public static Map buildBaselineSettings(String regionPrefix, boolean use2ndLevel, boolean useQueries, Class<? extends JtaPlatform> jtaPlatform) { Map settings = new HashMap(); settings.put(AvailableSettings.GENERATE_STATISTICS, "true"); settings.put(AvailableSettings.USE_STRUCTURED_CACHE, "true"); if (jtaPlatform == null || jtaPlatform == NoJtaPlatform.class) { settings.put(Environment.TRANSACTION_COORDINATOR_STRATEGY, JdbcResourceLocalTransactionCoordinatorBuilderImpl.class.getName()); settings.put(AvailableSettings.JTA_PLATFORM, NoJtaPlatform.class); } else {/*from w w w . j a va 2 s . c om*/ settings.put(Environment.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName()); settings.put(AvailableSettings.JTA_PLATFORM, jtaPlatform); } settings.put(AvailableSettings.CACHE_REGION_FACTORY, TestRegionFactoryProvider.load().getRegionFactoryClass()); settings.put(AvailableSettings.CACHE_REGION_PREFIX, regionPrefix); settings.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, String.valueOf(use2ndLevel)); settings.put(AvailableSettings.USE_QUERY_CACHE, String.valueOf(useQueries)); return settings; }
From source file:org.infinispan.test.hibernate.cache.util.CacheTestUtil.java
License:LGPL
@SuppressWarnings("unchecked") public static Map buildBaselineSettings(String regionPrefix, Class regionFactory, boolean use2ndLevel, boolean useQueries, Class<? extends JtaPlatform> jtaPlatform) { Map settings = new HashMap(); settings.put(AvailableSettings.GENERATE_STATISTICS, "true"); settings.put(AvailableSettings.USE_STRUCTURED_CACHE, "true"); if (jtaPlatform == null) { settings.put(Environment.TRANSACTION_COORDINATOR_STRATEGY, JdbcResourceLocalTransactionCoordinatorBuilderImpl.class.getName()); } else {/*from www . ja v a2 s . co m*/ settings.put(Environment.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName()); settings.put(AvailableSettings.JTA_PLATFORM, jtaPlatform); } settings.put(AvailableSettings.CACHE_REGION_FACTORY, regionFactory.getName()); settings.put(AvailableSettings.CACHE_REGION_PREFIX, regionPrefix); settings.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, String.valueOf(use2ndLevel)); settings.put(AvailableSettings.USE_QUERY_CACHE, String.valueOf(useQueries)); return settings; }