Examples of DialectFactory


Examples of net.sf.hajdbc.dialect.DialectFactory

  {
    this.driver = this.database.getConnectionSource();
    this.password = this.database.decodePassword(this.cluster.getDecoder());
    this.pool = this.poolFactory.createPool(new ConnectionPoolProvider(this));
   
    DialectFactory factory = ServiceLoaders.findService(new IdentifiableMatcher<DialectFactory>(this.database.parseVendor()), DialectFactory.class);
    if (factory == null)
    {
      // Use default dialect
      factory = ServiceLoaders.findRequiredService(DialectFactory.class);
    }
   
    Dialect dialect = factory.createDialect();

    Connection connection = this.pool.take();
   
    try
    {
View Full Code Here

Examples of net.sf.hajdbc.dialect.DialectFactory

  {
    this.driver = this.database.createConnectionSource();
    this.password = this.database.decodePassword(this.cluster.getDecoder());
    this.pool = this.poolFactory.createPool(new ConnectionPoolProvider(this));
   
    DialectFactory factory = ServiceLoaders.findService(new IdentifiableMatcher<DialectFactory>(this.database.parseVendor()), DialectFactory.class);
    if (factory == null)
    {
      // Use default dialect
      factory = ServiceLoaders.findRequiredService(DialectFactory.class);
    }
   
    Dialect dialect = factory.createDialect();

    Connection connection = this.pool.take();
   
    try
    {
View Full Code Here

Examples of net.sf.hajdbc.dialect.DialectFactory

  {
    this.driver = this.database.getConnectionSource();
    this.password = this.database.decodePassword(this.cluster.getDecoder());
    this.pool = this.poolFactory.createPool(new ConnectionPoolProvider(this));
   
    DialectFactory factory = ServiceLoaders.findService(new IdentifiableMatcher<DialectFactory>(this.database.parseVendor()), DialectFactory.class);
    if (factory == null)
    {
      // Use default dialect
      factory = ServiceLoaders.findRequiredService(DialectFactory.class);
    }
   
    Dialect dialect = factory.createDialect();

    Connection connection = this.pool.take();
   
    try
    {
View Full Code Here

Examples of org.hibernate.engine.jdbc.dialect.spi.DialectFactory

  }

  @Override
  public void configure(Map configValues) {
    final JdbcConnectionAccess jdbcConnectionAccess = buildJdbcConnectionAccess( configValues );
    final DialectFactory dialectFactory = serviceRegistry.getService( DialectFactory.class );

    Dialect dialect = null;
    LobCreatorBuilder lobCreatorBuilder = null;

    boolean metaSupportsRefCursors = false;
    boolean metaSupportsNamedParams = false;
    boolean metaSupportsScrollable = false;
    boolean metaSupportsGetGeneratedKeys = false;
    boolean metaSupportsBatchUpdates = false;
    boolean metaReportsDDLCausesTxnCommit = false;
    boolean metaReportsDDLInTxnSupported = true;
    String extraKeywordsString = "";
    int sqlStateType = -1;
    boolean lobLocatorUpdateCopy = false;
    String catalogName = null;
    String schemaName = null;
    final LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();

    // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value.
    // The need for it is intended to be alleviated with future development, thus it is
    // not defined as an Environment constant...
    //
    // it is used to control whether we should consult the JDBC metadata to determine
    // certain Settings default values; it is useful to *not* do this when the database
    // may not be available (mainly in tools usage).
    final boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", configValues, true );
    if ( useJdbcMetadata ) {
      try {
        final Connection connection = jdbcConnectionAccess.obtainConnection();
        try {
          final DatabaseMetaData meta = connection.getMetaData();
          if ( LOG.isDebugEnabled() ) {
            LOG.debugf(
                "Database ->\n"
                    + "       name : %s\n"
                    + "    version : %s\n"
                    + "      major : %s\n"
                    + "      minor : %s",
                meta.getDatabaseProductName(),
                meta.getDatabaseProductVersion(),
                meta.getDatabaseMajorVersion(),
                meta.getDatabaseMinorVersion()
            );
            LOG.debugf(
                "Driver ->\n"
                    + "       name : %s\n"
                    + "    version : %s\n"
                    + "      major : %s\n"
                    + "      minor : %s",
                meta.getDriverName(),
                meta.getDriverVersion(),
                meta.getDriverMajorVersion(),
                meta.getDriverMinorVersion()
            );
            LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
          }

          metaSupportsRefCursors = StandardRefCursorSupport.supportsRefCursors( meta );
          metaSupportsNamedParams = meta.supportsNamedParameters();
          metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
          metaSupportsBatchUpdates = meta.supportsBatchUpdates();
          metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
          metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
          metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
          extraKeywordsString = meta.getSQLKeywords();
          sqlStateType = meta.getSQLStateType();
          lobLocatorUpdateCopy = meta.locatorsUpdateCopy();
          typeInfoSet.addAll( TypeInfo.extractTypeInfo( meta ) );

          dialect = dialectFactory.buildDialect(
              configValues,
              new DialectResolutionInfoSource() {
                @Override
                public DialectResolutionInfo getDialectResolutionInfo() {
                  try {
                    return new DatabaseMetaDataDialectResolutionInfoAdapter( connection.getMetaData() );
                  }
                  catch ( SQLException sqlException ) {
                    throw new HibernateException(
                        "Unable to access java.sql.DatabaseMetaData to determine appropriate Dialect to use",
                        sqlException
                    );
                  }
                }
              }
          );

          catalogName = connection.getCatalog();
          final SchemaNameResolver schemaNameResolver = determineExplicitSchemaNameResolver( configValues );
          if ( schemaNameResolver == null ) {
// todo : add dialect method
//            schemaNameResolver = dialect.getSchemaNameResolver();
          }
          if ( schemaNameResolver != null ) {
            schemaName = schemaNameResolver.resolveSchemaName( connection );
          }
          lobCreatorBuilder = new LobCreatorBuilder( configValues, connection );
        }
        catch ( SQLException sqle ) {
          LOG.unableToObtainConnectionMetadata( sqle.getMessage() );
        }
        finally {
          if ( connection != null ) {
            jdbcConnectionAccess.releaseConnection( connection );
          }
        }
      }
      catch ( SQLException sqle ) {
        LOG.unableToObtainConnectionToQueryMetadata( sqle.getMessage() );
        dialect = dialectFactory.buildDialect( configValues, null );
      }
      catch ( UnsupportedOperationException uoe ) {
        // user supplied JDBC connections
        dialect = dialectFactory.buildDialect( configValues, null );
      }
    }
    else {
      dialect = dialectFactory.buildDialect( configValues, null );
    }

    final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false );
    final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false );

View Full Code Here

Examples of org.hibernate.engine.jdbc.dialect.spi.DialectFactory

  }

  @Override
  public void configure(Map configValues) {
    final JdbcConnectionAccess jdbcConnectionAccess = buildJdbcConnectionAccess( configValues );
    final DialectFactory dialectFactory = serviceRegistry.getService( DialectFactory.class );

    Dialect dialect = null;
    LobCreatorBuilder lobCreatorBuilder = null;

    boolean metaSupportsRefCursors = false;
    boolean metaSupportsNamedParams = false;
    boolean metaSupportsScrollable = false;
    boolean metaSupportsGetGeneratedKeys = false;
    boolean metaSupportsBatchUpdates = false;
    boolean metaReportsDDLCausesTxnCommit = false;
    boolean metaReportsDDLInTxnSupported = true;
    String extraKeywordsString = "";
    int sqlStateType = -1;
    boolean lobLocatorUpdateCopy = false;
    String catalogName = null;
    String schemaName = null;
    final LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();

    // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value.
    // The need for it is intended to be alleviated with future development, thus it is
    // not defined as an Environment constant...
    //
    // it is used to control whether we should consult the JDBC metadata to determine
    // certain Settings default values; it is useful to *not* do this when the database
    // may not be available (mainly in tools usage).
    final boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", configValues, true );
    if ( useJdbcMetadata ) {
      try {
        final Connection connection = jdbcConnectionAccess.obtainConnection();
        try {
          final DatabaseMetaData meta = connection.getMetaData();
          if ( LOG.isDebugEnabled() ) {
            LOG.debugf(
                "Database ->\n"
                    + "       name : %s\n"
                    + "    version : %s\n"
                    + "      major : %s\n"
                    + "      minor : %s",
                meta.getDatabaseProductName(),
                meta.getDatabaseProductVersion(),
                meta.getDatabaseMajorVersion(),
                meta.getDatabaseMinorVersion()
            );
            LOG.debugf(
                "Driver ->\n"
                    + "       name : %s\n"
                    + "    version : %s\n"
                    + "      major : %s\n"
                    + "      minor : %s",
                meta.getDriverName(),
                meta.getDriverVersion(),
                meta.getDriverMajorVersion(),
                meta.getDriverMinorVersion()
            );
            LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
          }

          metaSupportsRefCursors = StandardRefCursorSupport.supportsRefCursors( meta );
          metaSupportsNamedParams = meta.supportsNamedParameters();
          metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
          metaSupportsBatchUpdates = meta.supportsBatchUpdates();
          metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
          metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
          metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
          extraKeywordsString = meta.getSQLKeywords();
          sqlStateType = meta.getSQLStateType();
          lobLocatorUpdateCopy = meta.locatorsUpdateCopy();
          typeInfoSet.addAll( TypeInfo.extractTypeInfo( meta ) );

          dialect = dialectFactory.buildDialect( configValues, connection );

          catalogName = connection.getCatalog();
          final SchemaNameResolver schemaNameResolver = determineExplicitSchemaNameResolver( configValues );
          if ( schemaNameResolver == null ) {
// todo : add dialect method
//            schemaNameResolver = dialect.getSchemaNameResolver();
          }
          if ( schemaNameResolver != null ) {
            schemaName = schemaNameResolver.resolveSchemaName( connection );
          }
          lobCreatorBuilder = new LobCreatorBuilder( configValues, connection );
        }
        catch ( SQLException sqle ) {
          LOG.unableToObtainConnectionMetadata( sqle.getMessage() );
        }
        finally {
          if ( connection != null ) {
            jdbcConnectionAccess.releaseConnection( connection );
          }
        }
      }
      catch ( SQLException sqle ) {
        LOG.unableToObtainConnectionToQueryMetadata( sqle.getMessage() );
        dialect = dialectFactory.buildDialect( configValues, null );
      }
      catch ( UnsupportedOperationException uoe ) {
        // user supplied JDBC connections
        dialect = dialectFactory.buildDialect( configValues, null );
      }
    }
    else {
      dialect = dialectFactory.buildDialect( configValues, null );
    }

    final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false );
    final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false );

View Full Code Here

Examples of org.hibernate.engine.jdbc.dialect.spi.DialectFactory

  }

  @Override
  public void configure(Map configValues) {
    final JdbcConnectionAccess jdbcConnectionAccess = buildJdbcConnectionAccess( configValues );
    final DialectFactory dialectFactory = serviceRegistry.getService( DialectFactory.class );

    Dialect dialect = null;
    LobCreatorBuilder lobCreatorBuilder = null;

    boolean metaSupportsRefCursors = false;
    boolean metaSupportsNamedParams = false;
    boolean metaSupportsScrollable = false;
    boolean metaSupportsGetGeneratedKeys = false;
    boolean metaSupportsBatchUpdates = false;
    boolean metaReportsDDLCausesTxnCommit = false;
    boolean metaReportsDDLInTxnSupported = true;
    String extraKeywordsString = "";
    int sqlStateType = -1;
    boolean lobLocatorUpdateCopy = false;
    String catalogName = null;
    String schemaName = null;
    final LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();

    // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value.
    // The need for it is intended to be alleviated with future development, thus it is
    // not defined as an Environment constant...
    //
    // it is used to control whether we should consult the JDBC metadata to determine
    // certain Settings default values; it is useful to *not* do this when the database
    // may not be available (mainly in tools usage).
    final boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", configValues, true );
    if ( useJdbcMetadata ) {
      try {
        final Connection connection = jdbcConnectionAccess.obtainConnection();
        try {
          final DatabaseMetaData meta = connection.getMetaData();
          if ( LOG.isDebugEnabled() ) {
            LOG.debugf(
                "Database ->\n"
                    + "       name : %s\n"
                    + "    version : %s\n"
                    + "      major : %s\n"
                    + "      minor : %s",
                meta.getDatabaseProductName(),
                meta.getDatabaseProductVersion(),
                meta.getDatabaseMajorVersion(),
                meta.getDatabaseMinorVersion()
            );
            LOG.debugf(
                "Driver ->\n"
                    + "       name : %s\n"
                    + "    version : %s\n"
                    + "      major : %s\n"
                    + "      minor : %s",
                meta.getDriverName(),
                meta.getDriverVersion(),
                meta.getDriverMajorVersion(),
                meta.getDriverMinorVersion()
            );
            LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
          }

          metaSupportsRefCursors = StandardRefCursorSupport.supportsRefCursors( meta );
          metaSupportsNamedParams = meta.supportsNamedParameters();
          metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
          metaSupportsBatchUpdates = meta.supportsBatchUpdates();
          metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
          metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
          metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
          extraKeywordsString = meta.getSQLKeywords();
          sqlStateType = meta.getSQLStateType();
          lobLocatorUpdateCopy = meta.locatorsUpdateCopy();
          typeInfoSet.addAll( TypeInfo.extractTypeInfo( meta ) );

          dialect = dialectFactory.buildDialect(
              configValues,
              new DialectResolutionInfoSource() {
                @Override
                public DialectResolutionInfo getDialectResolutionInfo() {
                  try {
                    return new DatabaseMetaDataDialectResolutionInfoAdapter( connection.getMetaData() );
                  }
                  catch ( SQLException sqlException ) {
                    throw new HibernateException(
                        "Unable to access java.sql.DatabaseMetaData to determine appropriate Dialect to use",
                        sqlException
                    );
                  }
                }
              }
          );

          catalogName = connection.getCatalog();
          final SchemaNameResolver schemaNameResolver = determineExplicitSchemaNameResolver( configValues );
          if ( schemaNameResolver == null ) {
// todo : add dialect method
//            schemaNameResolver = dialect.getSchemaNameResolver();
          }
          if ( schemaNameResolver != null ) {
            schemaName = schemaNameResolver.resolveSchemaName( connection );
          }
          lobCreatorBuilder = new LobCreatorBuilder( configValues, connection );
        }
        catch ( SQLException sqle ) {
          LOG.unableToObtainConnectionMetadata( sqle.getMessage() );
        }
        finally {
          if ( connection != null ) {
            jdbcConnectionAccess.releaseConnection( connection );
          }
        }
      }
      catch ( SQLException sqle ) {
        LOG.unableToObtainConnectionToQueryMetadata( sqle.getMessage() );
        dialect = dialectFactory.buildDialect( configValues, null );
      }
      catch ( UnsupportedOperationException uoe ) {
        // user supplied JDBC connections
        dialect = dialectFactory.buildDialect( configValues, null );
      }
    }
    else {
      dialect = dialectFactory.buildDialect( configValues, null );
    }

    final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false );
    final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false );

View Full Code Here

Examples of org.hibernate.engine.jdbc.dialect.spi.DialectFactory

  }

  @Override
  public void configure(Map configValues) {
    final JdbcConnectionAccess jdbcConnectionAccess = buildJdbcConnectionAccess( configValues );
    final DialectFactory dialectFactory = serviceRegistry.getService( DialectFactory.class );

    Dialect dialect = null;
    LobCreatorBuilder lobCreatorBuilder = null;

    boolean metaSupportsRefCursors = false;
    boolean metaSupportsNamedParams = false;
    boolean metaSupportsScrollable = false;
    boolean metaSupportsGetGeneratedKeys = false;
    boolean metaSupportsBatchUpdates = false;
    boolean metaReportsDDLCausesTxnCommit = false;
    boolean metaReportsDDLInTxnSupported = true;
    String extraKeywordsString = "";
    int sqlStateType = -1;
    boolean lobLocatorUpdateCopy = false;
    String catalogName = null;
    String schemaName = null;
    LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();

    // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value.
    // The need for it is intended to be alleviated with future development, thus it is
    // not defined as an Environment constant...
    //
    // it is used to control whether we should consult the JDBC metadata to determine
    // certain Settings default values; it is useful to *not* do this when the database
    // may not be available (mainly in tools usage).
    boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", configValues, true );
    if ( useJdbcMetadata ) {
      try {
        Connection connection = jdbcConnectionAccess.obtainConnection();
        try {
          DatabaseMetaData meta = connection.getMetaData();
          if(LOG.isDebugEnabled()) {
            LOG.debugf( "Database ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDatabaseProductName(),
                  meta.getDatabaseProductVersion(),
                  meta.getDatabaseMajorVersion(),
                  meta.getDatabaseMinorVersion()
            );
            LOG.debugf( "Driver ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDriverName(),
                  meta.getDriverVersion(),
                  meta.getDriverMajorVersion(),
                  meta.getDriverMinorVersion()
            );
            LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
          }

          metaSupportsRefCursors = StandardRefCursorSupport.supportsRefCursors( meta );
          metaSupportsNamedParams = meta.supportsNamedParameters();
          metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
          metaSupportsBatchUpdates = meta.supportsBatchUpdates();
          metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
          metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
          metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
          extraKeywordsString = meta.getSQLKeywords();
          sqlStateType = meta.getSQLStateType();
          lobLocatorUpdateCopy = meta.locatorsUpdateCopy();
          typeInfoSet.addAll( TypeInfoExtracter.extractTypeInfo( meta ) );

          dialect = dialectFactory.buildDialect( configValues, connection );

          catalogName = connection.getCatalog();
          SchemaNameResolver schemaNameResolver = determineExplicitSchemaNameResolver( configValues );
          if ( schemaNameResolver == null ) {
// todo : add dialect method
//            schemaNameResolver = dialect.getSchemaNameResolver();
          }
          if ( schemaNameResolver != null ) {
            schemaName = schemaNameResolver.resolveSchemaName( connection );
          }
          lobCreatorBuilder = new LobCreatorBuilder( configValues, connection );
        }
        catch ( SQLException sqle ) {
          LOG.unableToObtainConnectionMetadata( sqle.getMessage() );
        }
        finally {
          if ( connection != null ) {
            jdbcConnectionAccess.releaseConnection( connection );
          }
        }
      }
      catch ( SQLException sqle ) {
        LOG.unableToObtainConnectionToQueryMetadata( sqle.getMessage() );
        dialect = dialectFactory.buildDialect( configValues, null );
      }
      catch ( UnsupportedOperationException uoe ) {
        // user supplied JDBC connections
        dialect = dialectFactory.buildDialect( configValues, null );
      }
    }
    else {
      dialect = dialectFactory.buildDialect( configValues, null );
    }

    final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false );
    final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false );

View Full Code Here

Examples of org.hibernate.engine.jdbc.dialect.spi.DialectFactory

  }

  @Override
  public void configure(Map configValues) {
    final JdbcConnectionAccess jdbcConnectionAccess = buildJdbcConnectionAccess( configValues );
    final DialectFactory dialectFactory = serviceRegistry.getService( DialectFactory.class );

    Dialect dialect = null;
    LobCreatorBuilder lobCreatorBuilder = null;

    boolean metaSupportsRefCursors = false;
    boolean metaSupportsNamedParams = false;
    boolean metaSupportsScrollable = false;
    boolean metaSupportsGetGeneratedKeys = false;
    boolean metaSupportsBatchUpdates = false;
    boolean metaReportsDDLCausesTxnCommit = false;
    boolean metaReportsDDLInTxnSupported = true;
    String extraKeywordsString = "";
    int sqlStateType = -1;
    boolean lobLocatorUpdateCopy = false;
    String catalogName = null;
    String schemaName = null;
    final LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();

    // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value.
    // The need for it is intended to be alleviated with future development, thus it is
    // not defined as an Environment constant...
    //
    // it is used to control whether we should consult the JDBC metadata to determine
    // certain Settings default values; it is useful to *not* do this when the database
    // may not be available (mainly in tools usage).
    final boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", configValues, true );
    if ( useJdbcMetadata ) {
      try {
        final Connection connection = jdbcConnectionAccess.obtainConnection();
        try {
          DatabaseMetaData meta = connection.getMetaData();
          if(LOG.isDebugEnabled()) {
            LOG.debugf( "Database ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDatabaseProductName(),
                  meta.getDatabaseProductVersion(),
                  meta.getDatabaseMajorVersion(),
                  meta.getDatabaseMinorVersion()
            );
            LOG.debugf( "Driver ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDriverName(),
                  meta.getDriverVersion(),
                  meta.getDriverMajorVersion(),
                  meta.getDriverMinorVersion()
            );
            LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
          }

          metaSupportsRefCursors = StandardRefCursorSupport.supportsRefCursors( meta );
          metaSupportsNamedParams = meta.supportsNamedParameters();
          metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
          metaSupportsBatchUpdates = meta.supportsBatchUpdates();
          metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
          metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
          metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
          extraKeywordsString = meta.getSQLKeywords();
          sqlStateType = meta.getSQLStateType();
          lobLocatorUpdateCopy = meta.locatorsUpdateCopy();
          typeInfoSet.addAll( TypeInfoExtracter.extractTypeInfo( meta ) );

          dialect = dialectFactory.buildDialect( configValues, connection );

          catalogName = connection.getCatalog();
          final SchemaNameResolver schemaNameResolver = determineExplicitSchemaNameResolver( configValues );
          if ( schemaNameResolver == null ) {
// todo : add dialect method
//            schemaNameResolver = dialect.getSchemaNameResolver();
          }
          if ( schemaNameResolver != null ) {
            schemaName = schemaNameResolver.resolveSchemaName( connection );
          }
          lobCreatorBuilder = new LobCreatorBuilder( configValues, connection );
        }
        catch ( SQLException sqle ) {
          LOG.unableToObtainConnectionMetadata( sqle.getMessage() );
        }
        finally {
          if ( connection != null ) {
            jdbcConnectionAccess.releaseConnection( connection );
          }
        }
      }
      catch ( SQLException sqle ) {
        LOG.unableToObtainConnectionToQueryMetadata( sqle.getMessage() );
        dialect = dialectFactory.buildDialect( configValues, null );
      }
      catch ( UnsupportedOperationException uoe ) {
        // user supplied JDBC connections
        dialect = dialectFactory.buildDialect( configValues, null );
      }
    }
    else {
      dialect = dialectFactory.buildDialect( configValues, null );
    }

    final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false );
    final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false );

View Full Code Here

Examples of org.hibernate.service.jdbc.dialect.spi.DialectFactory

  }

  @Override
  public void configure(Map configValues) {
    final JdbcConnectionAccess jdbcConnectionAccess = buildJdbcConnectionAccess( configValues );
    final DialectFactory dialectFactory = serviceRegistry.getService( DialectFactory.class );

    Dialect dialect = null;
    LobCreatorBuilder lobCreatorBuilder = null;

    boolean metaSupportsScrollable = false;
    boolean metaSupportsGetGeneratedKeys = false;
    boolean metaSupportsBatchUpdates = false;
    boolean metaReportsDDLCausesTxnCommit = false;
    boolean metaReportsDDLInTxnSupported = true;
    String extraKeywordsString = "";
    int sqlStateType = -1;
    boolean lobLocatorUpdateCopy = false;
    String catalogName = null;
    String schemaName = null;
    LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();

    // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value.
    // The need for it is intended to be alleviated with future development, thus it is
    // not defined as an Environment constant...
    //
    // it is used to control whether we should consult the JDBC metadata to determine
    // certain Settings default values; it is useful to *not* do this when the database
    // may not be available (mainly in tools usage).
    boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", configValues, true );
    if ( useJdbcMetadata ) {
      try {
        Connection connection = jdbcConnectionAccess.obtainConnection();
        try {
          DatabaseMetaData meta = connection.getMetaData();
          if(LOG.isDebugEnabled()) {
            LOG.debugf( "Database ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDatabaseProductName(),
                  meta.getDatabaseProductVersion(),
                  meta.getDatabaseMajorVersion(),
                  meta.getDatabaseMinorVersion()
            );
            LOG.debugf( "Driver ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDriverName(),
                  meta.getDriverVersion(),
                  meta.getDriverMajorVersion(),
                  meta.getDriverMinorVersion()
            );
            LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
          }

          metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
          metaSupportsBatchUpdates = meta.supportsBatchUpdates();
          metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
          metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
          metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
          extraKeywordsString = meta.getSQLKeywords();
          sqlStateType = meta.getSQLStateType();
          lobLocatorUpdateCopy = meta.locatorsUpdateCopy();
          typeInfoSet.addAll( TypeInfoExtracter.extractTypeInfo( meta ) );

          dialect = dialectFactory.buildDialect( configValues, connection );

          catalogName = connection.getCatalog();
          SchemaNameResolver schemaNameResolver = determineExplicitSchemaNameResolver( configValues );
          if ( schemaNameResolver == null ) {
// todo : add dialect method
//            schemaNameResolver = dialect.getSchemaNameResolver();
          }
          if ( schemaNameResolver != null ) {
            schemaName = schemaNameResolver.resolveSchemaName( connection );
          }
          lobCreatorBuilder = new LobCreatorBuilder( configValues, connection );
        }
        catch ( SQLException sqle ) {
          LOG.unableToObtainConnectionMetadata( sqle.getMessage() );
        }
        finally {
          if ( connection != null ) {
            jdbcConnectionAccess.releaseConnection( connection );
          }
        }
      }
      catch ( SQLException sqle ) {
        LOG.unableToObtainConnectionToQueryMetadata( sqle.getMessage() );
        dialect = dialectFactory.buildDialect( configValues, null );
      }
      catch ( UnsupportedOperationException uoe ) {
        // user supplied JDBC connections
        dialect = dialectFactory.buildDialect( configValues, null );
      }
    }
    else {
      dialect = dialectFactory.buildDialect( configValues, null );
    }

    final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false );
    final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false );

View Full Code Here

Examples of org.hibernate.service.jdbc.dialect.spi.DialectFactory

  }

  @Override
  public void configure(Map configValues) {
    final JdbcConnectionAccess jdbcConnectionAccess = buildJdbcConnectionAccess( configValues );
    final DialectFactory dialectFactory = serviceRegistry.getService( DialectFactory.class );

    Dialect dialect = null;
    LobCreatorBuilder lobCreatorBuilder = null;

    boolean metaSupportsScrollable = false;
    boolean metaSupportsGetGeneratedKeys = false;
    boolean metaSupportsBatchUpdates = false;
    boolean metaReportsDDLCausesTxnCommit = false;
    boolean metaReportsDDLInTxnSupported = true;
    String extraKeywordsString = "";
    int sqlStateType = -1;
    boolean lobLocatorUpdateCopy = false;
    String catalogName = null;
    String schemaName = null;
    LinkedHashSet<TypeInfo> typeInfoSet = new LinkedHashSet<TypeInfo>();

    // 'hibernate.temp.use_jdbc_metadata_defaults' is a temporary magic value.
    // The need for it is intended to be alleviated with future development, thus it is
    // not defined as an Environment constant...
    //
    // it is used to control whether we should consult the JDBC metadata to determine
    // certain Settings default values; it is useful to *not* do this when the database
    // may not be available (mainly in tools usage).
    boolean useJdbcMetadata = ConfigurationHelper.getBoolean( "hibernate.temp.use_jdbc_metadata_defaults", configValues, true );
    if ( useJdbcMetadata ) {
      try {
        Connection connection = jdbcConnectionAccess.obtainConnection();
        try {
          DatabaseMetaData meta = connection.getMetaData();
          if(LOG.isDebugEnabled()) {
            LOG.debugf( "Database ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDatabaseProductName(),
                  meta.getDatabaseProductVersion(),
                  meta.getDatabaseMajorVersion(),
                  meta.getDatabaseMinorVersion()
            );
            LOG.debugf( "Driver ->\n" + "       name : %s\n" + "    version : %s\n" + "      major : %s\n" + "      minor : %s",
                  meta.getDriverName(),
                  meta.getDriverVersion(),
                  meta.getDriverMajorVersion(),
                  meta.getDriverMinorVersion()
            );
            LOG.debugf( "JDBC version : %s.%s", meta.getJDBCMajorVersion(), meta.getJDBCMinorVersion() );
          }

          metaSupportsScrollable = meta.supportsResultSetType( ResultSet.TYPE_SCROLL_INSENSITIVE );
          metaSupportsBatchUpdates = meta.supportsBatchUpdates();
          metaReportsDDLCausesTxnCommit = meta.dataDefinitionCausesTransactionCommit();
          metaReportsDDLInTxnSupported = !meta.dataDefinitionIgnoredInTransactions();
          metaSupportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
          extraKeywordsString = meta.getSQLKeywords();
          sqlStateType = meta.getSQLStateType();
          lobLocatorUpdateCopy = meta.locatorsUpdateCopy();
          typeInfoSet.addAll( TypeInfoExtracter.extractTypeInfo( meta ) );

          dialect = dialectFactory.buildDialect( configValues, connection );

          catalogName = connection.getCatalog();
          SchemaNameResolver schemaNameResolver = determineExplicitSchemaNameResolver( configValues );
          if ( schemaNameResolver == null ) {
// todo : add dialect method
//            schemaNameResolver = dialect.getSchemaNameResolver();
          }
          if ( schemaNameResolver != null ) {
            schemaName = schemaNameResolver.resolveSchemaName( connection );
          }
          lobCreatorBuilder = new LobCreatorBuilder( configValues, connection );
        }
        catch ( SQLException sqle ) {
          LOG.unableToObtainConnectionMetadata( sqle.getMessage() );
        }
        finally {
          if ( connection != null ) {
            jdbcConnectionAccess.releaseConnection( connection );
          }
        }
      }
      catch ( SQLException sqle ) {
        LOG.unableToObtainConnectionToQueryMetadata( sqle.getMessage() );
        dialect = dialectFactory.buildDialect( configValues, null );
      }
      catch ( UnsupportedOperationException uoe ) {
        // user supplied JDBC connections
        dialect = dialectFactory.buildDialect( configValues, null );
      }
    }
    else {
      dialect = dialectFactory.buildDialect( configValues, null );
    }

    final boolean showSQL = ConfigurationHelper.getBoolean( Environment.SHOW_SQL, configValues, false );
    final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false );

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.