Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-4581

JDBCPersistenceAdapter can ignore statements settings depending on configuration order.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.8.0
    • 5.9.0
    • Message Store
    • None

    Description

      When a jdbcPersistenceAdapter is configured using the "adapter" attribute (as below), the tablePrefix specified in the statements element is ignored during table creation.

      <jdbcPersistenceAdapter createTablesOnStartup="true" dataSource="#mysql-ds" adapter="#sybase-adapter"  useDatabaseLock="true">
        <statements>
          <statements tablePrefix="myprefix_"/>
        </statements>
      </jdbcPersistenceAdapter>
      
        .....
      <bean id="sybase-adapter" class="org.apache.activemq.store.jdbc.adapter.SybaseJDBCAdapter"/>
      
      

      It seems spring is calling the org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.setAdapter() method before org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.setStatements() is called. The setAdapter() triggers the table creation - hence no *tablePrefix" is used.

      This problems can be worked around if the adapter is configured as an element (as below) however this isn't the most ideal fix.

      <persistenceAdapter>
        <jdbcPersistenceAdapter>
          <statements>
            <statements tablePrefix="myprefix_"/>
          </statements>
          <adapter>
            <sybase-jdbc-adapter/>
          </adapter>
        </jdbcPersistenceAdapter>
      </persistenceAdapter>
      

      Attachments

        Issue Links

          Activity

            People

              tabish Timothy A. Bish
              tabish Timothy A. Bish
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: