Class DialectUtil


  • public abstract class DialectUtil
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PLACEHOLDER_DIALECT
      The placeholder for the configured Dialect class name: ${db.script.dialect}
    • Constructor Summary

      Constructors 
      Constructor Description
      DialectUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.springframework.core.io.Resource getDialectResource​(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver, java.lang.Class<?> dialectClass, java.lang.String resourceUrl)
      Replaces the dialect placeholder in the resource URL and attempts to find a file for it.
      static java.lang.String resolveDialectUrl​(java.lang.Class<?> dialectClass, java.lang.String resourceUrl)
      Takes resource URL containing the dialect placeholder text and substitutes the placeholder with the name of the given dialect's class.
      • Methods inherited from class java.lang.Object

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

      • PLACEHOLDER_DIALECT

        public static final java.lang.String PLACEHOLDER_DIALECT
        The placeholder for the configured Dialect class name: ${db.script.dialect}
        See Also:
        Constant Field Values
    • Constructor Detail

      • DialectUtil

        public DialectUtil()
    • Method Detail

      • getDialectResource

        public static org.springframework.core.io.Resource getDialectResource​(org.springframework.core.io.support.ResourcePatternResolver resourcePatternResolver,
                                                                              java.lang.Class<?> dialectClass,
                                                                              java.lang.String resourceUrl)
        Replaces the dialect placeholder in the resource URL and attempts to find a file for it. If not found, the dialect hierarchy will be walked until a compatible resource is found. This makes it possible to have resources that are generic to all dialects.
        Returns:
        The Resource, otherwise null
      • resolveDialectUrl

        public static java.lang.String resolveDialectUrl​(java.lang.Class<?> dialectClass,
                                                         java.lang.String resourceUrl)
        Takes resource URL containing the dialect placeholder text and substitutes the placeholder with the name of the given dialect's class.

        For example:

         resolveDialectUrl(MySQLInnoDBDialect.class, "classpath:alfresco/db/${db.script.dialect}/myfile.xml")
         
        would give the following String:
           classpath:alfresco/db/org.hibernate.dialect.MySQLInnoDBDialect/myfile.xml