1

As per documentation, JDBCMetadataStore requires an instance of DataSourceTransactionManager and this makes sense. What if I'm using JPA as primary transaction manager in the application? How can I tell to JDBCMetadataStore which transaction manager it should make use when calling the @Transactional methods - assuming I have to have 2 flavours of transaction manager beans in the application. Suggestions are welcome!

André Diniz
  • 306
  • 3
  • 15

1 Answers1

2

I suggest you to extend that JdbcMetadataStore and override all the transactional methods with delegation to super and @Transactional with the specific TX manager:

public class MyJdbcMetadataStore extends JdbcMetadataStore {

    public MyJdbcMetadataStore(DataSource dataSource) {
        super(dataSource);
    }

    @Override
    @Transactional("jdbcTransactionManager")
    public String putIfAbsent(String key, String value) {
        return super.putIfAbsent(key, value);
    }

}
Artem Bilan
  • 113,505
  • 11
  • 91
  • 118