5 Replies Latest reply on Mar 19, 2009 8:31 PM by navssurtani

    Transaction/Batch With Jboss Searchable cache is not working


      I am using searchable cache for my application.If i am adding the object to the searchable cache with in the context of Transaction or Batch,Searching is not working?.Is there any way to add the object in the context of Transaction/Batch and the same will be searched?Please clarify.

      Here i am attaching the Piece of code for reference

      getting the instance of Cache

      private static Cache cache = null;
      private static SearchableCache searchable =null;
      CacheFactory factory = new DefaultCacheFactory();
      cache = factory.createCache("abc.xml",false);
      searchable = new SearchableCacheFactory().createSearchableCache(cache,InstrumentVO.Class);

      Adding the Object to the Cache

      String fqn="/BrokerPosition/"+inst.getBrokerId()+"/"+inst.getClientId();
      TransactionManager mgr = argCache.getConfiguration().getRuntimeConfig().getTransactionManager();

      For searching I am using the following code

      searchable=getSearchableCache();//getting as by mentioned above

      QueryParser queryParser = new QueryParser("", new StandardAnalyzer());
      //instId is the field in the InstrumentVO
      Query luceneQuery = queryParser.parse("instId:INS1");
      CacheQuery cacheQuery = searchable.createQuery(luceneQuery);
      List results = cacheQuery.list();