Class DialectFactory


  • public class DialectFactory
    extends java.lang.Object
    A factory for generating Dialect instances.

    This class is an Alfresco-specific version of the Hibernate class with the same name.

    Since:
    6.0
    Author:
    Steve Ebersole, Alfresco
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  DialectFactory.DatabaseDialectMapper
      For a given database product name, instances of DatabaseDialectMapper know which Dialect to use for different versions.
      static class  DialectFactory.VersionInsensitiveMapper
      A simple DatabaseDialectMapper for dialects which are independent of the underlying database product version.
    • Constructor Summary

      Constructors 
      Constructor Description
      DialectFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Dialect buildDialect​(java.lang.String dialectName)
      Returns a dialect instance given the name of the class to use.
      static Dialect buildDialect​(java.lang.String databaseName, int databaseMajorVersion, java.lang.String driverName)
      Builds an appropriate Dialect instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DialectFactory

        public DialectFactory()
    • Method Detail

      • buildDialect

        public static Dialect buildDialect​(java.lang.String databaseName,
                                           int databaseMajorVersion,
                                           java.lang.String driverName)
        Builds an appropriate Dialect instance.

        The JDBC driver, the database name and version (obtained from connection metadata) are used to make the determination.

        An exception is thrown if a dialect was not explicitly set and the database name is not known.

        Parameters:
        databaseName - The name of the database product (obtained from metadata).
        databaseMajorVersion - The major version of the database product (obtained from metadata).
        driverName - THe name of the JDBC driver
        Returns:
        The appropriate dialect.
      • buildDialect

        public static Dialect buildDialect​(java.lang.String dialectName)
        Returns a dialect instance given the name of the class to use.
        Parameters:
        dialectName - The name of the dialect class.
        Returns:
        The dialect instance.