Class MySQLDatabasePlatformBehavior

java.lang.Object
com.broadleafcommerce.enterprise.workflow.dao.simple.DatabasePlatformBehavior
com.broadleafcommerce.enterprise.workflow.dao.simple.MySQLDatabasePlatformBehavior
All Implemented Interfaces:
org.springframework.core.Ordered

public class MySQLDatabasePlatformBehavior extends DatabasePlatformBehavior
Provides overrides specific to the needs to MySQL. The MySQL JDBC driver converts dates to the database timezone. Since SimpleTransition uses raws SQL with no timezone conversions, the times get off when promoting/approving. This class works in conjunction with PlatformJDBCUtilImpl to wrap the dates with the proper MySQL functions for timezone conversion.
  • Field Details

    • LOG

      protected static final org.apache.commons.logging.Log LOG
    • em

      protected jakarta.persistence.EntityManager em
  • Constructor Details

    • MySQLDatabasePlatformBehavior

      public MySQLDatabasePlatformBehavior(jakarta.persistence.EntityManager em, String dialectName, Boolean requiresLowerCaseTableName, String safeStringPattern, String timestampPattern, Boolean integerBooleanRepresentation)
  • Method Details

    • convertTimestamp

      public String convertTimestamp(String formattedDate)
      Override for MySQL. MySQL converts times from the app server timezone to the database timezone. The timestampPattern for MySQL take this into account and requires a second pattern parameter for the app server timezone.
      Overrides:
      convertTimestamp in class DatabasePlatformBehavior
      Parameters:
      formattedDate -
      Returns:
      the date/time string with appropriate MySQL functions for conversation
    • lazyInitPlatformVariables

      protected void lazyInitPlatformVariables()
      lazyInitPlatformVariables checks with the MySQL database to verify that the database supports the app server TimeZone so that timezone conversations can take place correctly. The timezone will default to UTC if MySQL does not support the app server timezone.