开发者

Pentaho reporting connectionFactory has new method added but no description

I am in process of upgrading my pentaho reporting from 3.6.1 to 3.8.0 in my web application. when I updated all necessary jar fil开发者_Python百科es, I got one compilation error in one of my class which implements ConnectionProvider. following is my class.

public class DataSourceConnectionProvider implements ConnectionProvider
{

....

}

The error is saying that my class should implement getConnectionHash() method as it is defined in ConnectionProvider interface. but It was not there in 3.6.1 version. so I am bit confused why they have added it and how to implement it in my class.


This method returns a object that is comparable and hashable and is used during the caching of datasources. It allows us to build some sort of key to detect changes in the connection definition while many reports run within the same JVM.

The cache implementation itself does not know any of the details of the various datasources and the "ConnectionHash" allows us keep result-sets separate.

My basic implementation of it simply returns a ArrayList with all relevant connection properties added to it.

Simple example how and where it is needed:

Imagine you have a JDBC datasource that connects to a database where several schemas with the same table structures exists, for example in a multi-tenant environment where each tenant has his own schema.

With a query like "SELECT * FROM CUSTOMERS WHERE COUNTRY = ${country-parameter}" the datasource will return different datasets based on which tenant performs the query. The sum of "connection-hash", "query-name" and "parameter used in the query" now forms a unique identifier that we can use to store and later lookup the resultset from the cache.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜