Codota Logo
DialectResolver
Code IndexAdd Codota to your IDE (free)

How to use
DialectResolver
in
org.hibernate.engine.jdbc.dialect.spi

Best Java code snippets using org.hibernate.engine.jdbc.dialect.spi.DialectResolver (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: hibernate/hibernate-orm

@Override
public Dialect resolveDialect(DialectResolutionInfo info) {
  for ( DialectResolver resolver : resolvers ) {
    try {
      final Dialect dialect = resolver.resolveDialect( info );
      if ( dialect != null ) {
        return dialect;
      }
    }
    catch ( JDBCConnectionException e ) {
      throw e;
    }
    catch ( Exception e ) {
      LOG.exceptionInSubResolver( e.getMessage() );
    }
  }
  return null;
}
origin: hibernate/hibernate-orm

final String explicitDbMinor = (String) configurationValues.get( AvailableSettings.HBM2DDL_DB_MINOR_VERSION );
final Dialect indicatedDialect = serviceRegistry.getService( DialectResolver.class ).resolveDialect(
    new DialectResolutionInfo() {
      @Override
origin: hibernate/hibernate-orm

  /**
   * Determine the appropriate Dialect to use given the connection.
   *
   * @param resolutionInfoSource Access to DialectResolutionInfo used to resolve the Dialect.
   *
   * @return The appropriate dialect instance.
   *
   * @throws HibernateException No connection given or no resolver could make
   * the determination from the given connection.
   */
  private Dialect determineDialect(DialectResolutionInfoSource resolutionInfoSource) {
    if ( resolutionInfoSource == null ) {
      throw new HibernateException( "Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set" );
    }

    final DialectResolutionInfo info = resolutionInfoSource.getDialectResolutionInfo();
    final Dialect dialect = dialectResolver.resolveDialect( info );

    if ( dialect == null ) {
      throw new HibernateException(
          "Unable to determine Dialect to use [name=" + info.getDatabaseName() +
              ", majorVersion=" + info.getDatabaseMajorVersion() +
              "]; user must register resolver or explicitly set 'hibernate.dialect'"
      );
    }

    return dialect;
  }
}
origin: jamesagnew/hapi-fhir

try {
  DialectResolver dialectResolver = new StandardDialectResolver();
  Dialect dialect = dialectResolver.resolveDialect(new DatabaseMetaDataDialectResolutionInfoAdapter(connection.getMetaData()));
origin: org.hibernate.orm/hibernate-core

@Override
public Dialect resolveDialect(DialectResolutionInfo info) {
  for ( DialectResolver resolver : resolvers ) {
    try {
      final Dialect dialect = resolver.resolveDialect( info );
      if ( dialect != null ) {
        return dialect;
      }
    }
    catch ( JDBCConnectionException e ) {
      throw e;
    }
    catch ( Exception e ) {
      LOG.exceptionInSubResolver( e.getMessage() );
    }
  }
  return null;
}
origin: DSpace/DSpace

  @Override
  public Long execute(Connection connection) throws SQLException {
    Long nextVal = 0L;
    // Determine what dialect we are using for this DB
    DialectResolver dialectResolver = new StandardDialectResolver();
    Dialect dialect = dialectResolver
      .resolveDialect(new DatabaseMetaDataDialectResolutionInfoAdapter(connection.getMetaData()));
    // Find the next value in our sequence (based on DB dialect)
    try (PreparedStatement preparedStatement = connection
      .prepareStatement(dialect.getSequenceNextValString(HANDLE_SEQUENCE))) {
      // Execute query and return results
      try (ResultSet resultSet = preparedStatement.executeQuery()) {
        if (resultSet.next()) {
          // Return result of query (from first column)
          nextVal = resultSet.getLong(1);
        }
      }
    }
    return nextVal;
  }
};
origin: stackoverflow.com

Dialect dialect =  dialectResolver.resolveDialect(conn.getMetaData());
origin: stackoverflow.com

Dialect dialect =  dialectResolver.resolveDialect(conn.getMetaData());
origin: org.codehaus.griffon.plugins/griffon-hibernate5-core

  public String getDialect() {
    Connection connection = null;

    try {
      String dbName = (String) JdbcUtils.extractDatabaseMetaData(dataSource, "getDatabaseProductName");
      connection = dataSource.getConnection();

      DialectResolutionInfo dialectResolutionInfo = new DatabaseMetaDataDialectResolutionInfoAdapter(connection.getMetaData());
      Dialect hibernateDialect = dialectResolver.resolveDialect(dialectResolutionInfo);
      String hibernateDialectClassName = hibernateDialect.getClass().getName();

      if (GriffonNameUtils.isBlank(hibernateDialectClassName)) {
        throw new DatabaseException(
          "Could not determine Hibernate dialect for database name [" + dbName + "]!");
      }

      return hibernateDialectClassName;
    } catch (SQLException e) {
      throw new DatabaseException(e);
    } finally {
      JdbcUtils.closeConnection(connection);
    }
  }
}
origin: org.codehaus.griffon.plugins/griffon-hibernate4-core

  public String getDialect() {
    Connection connection = null;

    try {
      String dbName = (String) JdbcUtils.extractDatabaseMetaData(dataSource, "getDatabaseProductName");
      connection = dataSource.getConnection();

      DialectResolutionInfo dialectResolutionInfo = new DatabaseMetaDataDialectResolutionInfoAdapter(connection.getMetaData());
      Dialect hibernateDialect = dialectResolver.resolveDialect(dialectResolutionInfo);
      String hibernateDialectClassName = hibernateDialect.getClass().getName();

      if (GriffonNameUtils.isBlank(hibernateDialectClassName)) {
        throw new DatabaseException(
          "Could not determine Hibernate dialect for database name [" + dbName + "]!");
      }

      return hibernateDialectClassName;
    } catch (SQLException e) {
      throw new DatabaseException(e);
    } finally {
      JdbcUtils.closeConnection(connection);
    }
  }
}
origin: org.hibernate.orm/hibernate-core

final String explicitDbMinor = (String) configurationValues.get( AvailableSettings.HBM2DDL_DB_MINOR_VERSION );
final Dialect indicatedDialect = serviceRegistry.getService( DialectResolver.class ).resolveDialect(
    new DialectResolutionInfo() {
      @Override
origin: org.hibernate.orm/hibernate-core

  /**
   * Determine the appropriate Dialect to use given the connection.
   *
   * @param resolutionInfoSource Access to DialectResolutionInfo used to resolve the Dialect.
   *
   * @return The appropriate dialect instance.
   *
   * @throws HibernateException No connection given or no resolver could make
   * the determination from the given connection.
   */
  private Dialect determineDialect(DialectResolutionInfoSource resolutionInfoSource) {
    if ( resolutionInfoSource == null ) {
      throw new HibernateException( "Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set" );
    }

    final DialectResolutionInfo info = resolutionInfoSource.getDialectResolutionInfo();
    final Dialect dialect = dialectResolver.resolveDialect( info );

    if ( dialect == null ) {
      throw new HibernateException(
          "Unable to determine Dialect to use [name=" + info.getDatabaseName() +
              ", majorVersion=" + info.getDatabaseMajorVersion() +
              "]; user must register resolver or explicitly set 'hibernate.dialect'"
      );
    }

    return dialect;
  }
}
org.hibernate.engine.jdbc.dialect.spiDialectResolver

Javadoc

Contract for determining the Dialect to use based on information about the database / driver.

Most used methods

  • resolveDialect
    Determine the Dialect to use based on the given information. Implementations are expected to return

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JTextField (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now