Question

I am trying to flush the mondrian dimension cache by following code -

     org.olap4j.metadata.Schema OlapSchema = olapConnection.getOlapSchema();
     NamedList<org.olap4j.metadata.Cube> cubeList =  OlapSchema.getCubes();
     org.olap4j.metadata.Member m = null;
     for(org.olap4j.metadata.Cube cube: cubeList) {
    m = cube.lookupMember(IdentifierNode.parseIdentifier( "[Time].[2013].[Jul2013]").getSegmentList());
       final CacheControl cacheControl = olapConnection.getCacheControl(null);
       CacheControl.MemberSet regionTime = cacheControl.createMemberSet(mondrian.olap.Member)m, false);
       cacheControl.flush(regionTime);

     }

But this code is throwing a runtime error "MondrianOlap4jMember and mondrian.olap.member are incompatible"

Was it helpful?

Solution

Looks like you need to do the following to flush the cache - unwrap the member object returned by lookupMember function using Olap wrapper class like so -

m = cube.lookupMember(IdentifierNode.parseIdentifier( "[Time].[2013].[Jul2013]").getSegmentList()); OlapWrapper wrapper = (OlapWrapper)m; mondrian.olap.Member MondrianMember = wrapper.unwrap(mondrian.olap.Member.class);

And now call the flush method -

cacheControl.flush(MondrianMember);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top