-
Bug
-
Resolution: Done
-
Major
-
5.2.0.Final
-
None
-
Workaround Exists
-
Programmatically configuring a cache store in 5.1.x makes use of the LoaderConfigurationBuilder:
LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore()); lb.addProperty("dropTableOnExit", "false") .addProperty("createTableOnStart", "true") .addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory") .addProperty("connectionUrl", "jdbc:h2:file:/abs/path/string_based_db;DB_CLOSE_DELAY=1") .addProperty("driverClass", "org.h2.Driver") .addProperty("userName", "sa") .addProperty("idColumnName", "ID_COLUMN") .addProperty("idColumnType", "VARCHAR(255)") .addProperty("timestampColumnName", "TIMESTAMP_COLUMN") .addProperty("timestampColumnType", "BIGINT") .addProperty("dataColumnName", "DATA_COLUMN") .addProperty("dataColumnType", "BINARY") .addProperty("bucketTableNamePrefix", "MODE") .addProperty("cacheName", "default");
This code does not compile with 5.2.0.Beta2 because LoaderConfigurationBuilder now is parameterized by the type of LoaderConfiguration and builder, and the return type of addProperty(...) is LoaderConfigurationBuilder<T,S>. When the above 5.1.x-compatible code is used (as a raw type), the return type of addProperty(...) becomes Object and this breaks the fluent-API style code above.
For code that needs to compile against 5.1.x and 5.2.x, the workaround is to change the above code to remove the fluent-API usage:
LoaderConfigurationBuilder lb = configurationBuilder.loaders().addCacheLoader().cacheLoader(new JdbcBinaryCacheStore()); lb.addProperty("dropTableOnExit", "false"); lb.addProperty("createTableOnStart", "true"); lb.addProperty("connectionFactoryClass", "org.infinispan.loaders.jdbc.connectionfactory.PooledConnectionFactory"); lb.addProperty("connectionUrl", "jdbc:h2:file:/abs/path/string_based_db;DB_CLOSE_DELAY=1"); lb.addProperty("driverClass", "org.h2.Driver"); lb.addProperty("userName", "sa"); lb.addProperty("idColumnName", "ID_COLUMN"); lb.addProperty("idColumnType", "VARCHAR(255)"); lb.addProperty("timestampColumnName", "TIMESTAMP_COLUMN"); lb.addProperty("timestampColumnType", "BIGINT"); lb.addProperty("dataColumnName", "DATA_COLUMN"); lb.addProperty("dataColumnType", "BINARY"); lb.addProperty("bucketTableNamePrefix", "MODE"); lb.addProperty("cacheName", "default");