Timothy Bish created AMQ-4581:
---------------------------------

             Summary: JDBCPersistenceAdapter can ignore statements settings 
depending on configuration order.
                 Key: AMQ-4581
                 URL: https://issues.apache.org/jira/browse/AMQ-4581
             Project: ActiveMQ
          Issue Type: Bug
          Components: Message Store
    Affects Versions: 5.8.0
            Reporter: Timothy Bish
            Assignee: Timothy Bish
             Fix For: 5.9.0


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

{code}
<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"/>

{code}

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.

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


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to