Package org.hibernate.cfg

Examples of org.hibernate.cfg.Settings


    private String tenantIdentifier;

    SessionBuilderImpl(SessionFactoryImpl sessionFactory) {
      this.sessionFactory = sessionFactory;
      this.sessionOwner = null;
      final Settings settings = sessionFactory.settings;

      // set up default builder values...
      this.interceptor = sessionFactory.getInterceptor();
      this.connectionReleaseMode = settings.getConnectionReleaseMode();
      this.autoClose = settings.isAutoCloseSessionEnabled();
      this.flushBeforeCompletion = settings.isFlushBeforeCompletionEnabled();

      if ( sessionFactory.getCurrentTenantIdentifierResolver() != null ) {
        tenantIdentifier = sessionFactory.getCurrentTenantIdentifierResolver().resolveCurrentTenantIdentifier();
      }
    }
View Full Code Here


        Configuration cfg = CacheTestUtil.buildConfiguration("", JBossCacheRegionFactory.class, true, true);
       
        CacheInstanceManager cim = new MultiplexingCacheInstanceManager();
        JBossCacheRegionFactory regionFactory = new JBossCacheRegionFactory(cim);
       
        Settings settings = cfg.buildSettings();
        Properties properties = cfg.getProperties();
       
        regionFactory.start(settings, properties);       
        // Ensure we clean up
        registerFactory(regionFactory);
View Full Code Here

    public void testCacheLevelStaleWritesFail() throws Throwable {
       
        Configuration cfg = CacheTestUtil.buildConfiguration("", MultiplexedJBossCacheRegionFactory.class, true, false);
        cfg.setProperty(getConfigResourceKey(), getConfigResourceLocation());
       
        Settings settings = cfg.buildSettings();
       
        Fqn<String> fqn = Fqn.fromString("/whatever");
        JBossCacheRegionFactory regionFactory = (JBossCacheRegionFactory) settings.getRegionFactory();
        regionFactory.start(settings, cfg.getProperties());
       
        // Make sure we clean up when done
        testSupport.registerFactory(regionFactory);
       
View Full Code Here

    }
   
    public static JBossCacheRegionFactory startRegionFactory(Configuration cfg)
            throws ClassNotFoundException, InstantiationException, IllegalAccessException {
       
        Settings settings = cfg.buildSettings();
        Properties properties = cfg.getProperties();
       
        String factoryType = cfg.getProperty(Environment.CACHE_REGION_FACTORY);
        Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(factoryType);
        JBossCacheRegionFactory regionFactory = (JBossCacheRegionFactory) factoryClass.newInstance();
View Full Code Here

   }

   public static InfinispanRegionFactory startRegionFactory(Configuration cfg) throws ClassNotFoundException,
            InstantiationException, IllegalAccessException {

      Settings settings = cfg.buildSettings();
      Properties properties = cfg.getProperties();

      String factoryType = cfg.getProperty(Environment.CACHE_REGION_FACTORY);
      Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(factoryType);
      InfinispanRegionFactory regionFactory = (InfinispanRegionFactory) factoryClass.newInstance();
View Full Code Here

    final int length = concreteQueryStrings.length;
    translators = new QueryTranslator[length];
    List sqlStringList = new ArrayList();
    for ( int i=0; i<length; i++ ) {
      if ( collectionRole == null ) {
        Settings settings = factory.getSettings();
        QueryTranslatorFactory queryTranslatorFactory = settings.getQueryTranslatorFactory();
        translators[i] = queryTranslatorFactory
            .createQueryTranslator( hql, concreteQueryStrings[i], enabledFilters, factory );
        Map replacements = factory.getSettings().getQuerySubstitutions();
        /**
         * 以下のcompileメソッドで全ての本質的な動作が行われている。
 
View Full Code Here

  }

  protected String generateSubquery(PersistentClass model, Mapping mapping) {

    Dialect dialect = getFactory().getDialect();
    Settings settings = getFactory().getSettings();
   
    if ( !model.hasSubclasses() ) {
      return model.getTable().getQualifiedName(
          dialect,
          settings.getDefaultCatalogName(),
          settings.getDefaultSchemaName()
        );
    }

    HashSet columns = new LinkedHashSet();
    Iterator titer = model.getSubclassTableClosureIterator();
    while ( titer.hasNext() ) {
      Table table = (Table) titer.next();
      if ( !table.isAbstractUnionTable() ) {
        Iterator citer = table.getColumnIterator();
        while ( citer.hasNext() ) columns.add( citer.next() );
      }
    }

    StringBuffer buf = new StringBuffer()
      .append("( ");

    Iterator siter = new JoinedIterator(
      new SingletonIterator(model),
      model.getSubclassIterator()
    );

    while ( siter.hasNext() ) {
      PersistentClass clazz = (PersistentClass) siter.next();
      Table table = clazz.getTable();
      if ( !table.isAbstractUnionTable() ) {
        //TODO: move to .sql package!!
        buf.append("select ");
        Iterator citer = columns.iterator();
        while ( citer.hasNext() ) {
          Column col = (Column) citer.next();
          if ( !table.containsColumn(col) ) {
            int sqlType = col.getSqlTypeCode(mapping);
            buf.append( dialect.getSelectClauseNullString(sqlType) )
              .append(" as ");
          }
          buf.append( col.getName() );
          buf.append(", ");
        }
        buf.append( clazz.getSubclassId() )
          .append(" as clazz_");
        buf.append(" from ")
          .append( table.getQualifiedName(
              dialect,
              settings.getDefaultCatalogName(),
              settings.getDefaultSchemaName()
          ) );
        buf.append(" union ");
        if ( dialect.supportsUnionAll() ) {
          buf.append("all ");
        }
View Full Code Here

    private boolean autoJoinTransactions = true;
    private boolean flushBeforeCompletion;

    SessionBuilderImpl(SessionFactoryImpl sessionFactory) {
      this.sessionFactory = sessionFactory;
      final Settings settings = sessionFactory.settings;

      // set up default builder values...
      this.interceptor = sessionFactory.getInterceptor();
      this.connectionReleaseMode = settings.getConnectionReleaseMode();
      this.entityMode = settings.getDefaultEntityMode();
      this.autoClose = settings.isAutoCloseSessionEnabled();
      this.flushBeforeCompletion = settings.isFlushBeforeCompletionEnabled();
    }
View Full Code Here

        // set based on default values in schematool properties file if not already set
        PropertyPlaceholderConfigurer.setProperty(emfPersistenceLocationsPropName, emfPersistenceLocationsPropValue);
       
          Configuration configuration = determineHibernateConfiguration();
 
          Settings settings = null;
          if (exec || mode == Mode.UPDATE)
          {
              ClassPathXmlApplicationContext newContext = new SmartClassPathXmlApplicationContext(emfContextLocation);
              try {
                // get a reference to the factory bean, don't have it create a new EntityManager
View Full Code Here

    private String tenantIdentifier;

    SessionBuilderImpl(SessionFactoryImpl sessionFactory) {
      this.sessionFactory = sessionFactory;
      this.sessionOwner = null;
      final Settings settings = sessionFactory.settings;

      // set up default builder values...
      this.interceptor = sessionFactory.getInterceptor();
      this.connectionReleaseMode = settings.getConnectionReleaseMode();
      this.autoClose = settings.isAutoCloseSessionEnabled();
      this.flushBeforeCompletion = settings.isFlushBeforeCompletionEnabled();

      if ( sessionFactory.getCurrentTenantIdentifierResolver() != null ) {
        tenantIdentifier = sessionFactory.getCurrentTenantIdentifierResolver().resolveCurrentTenantIdentifier();
      }
    }
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.Settings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.