4 Replies Latest reply on Jun 19, 2007 8:54 AM by gmeroz

    JDBCCacheLoader does not delete item from table

    gmeroz Newbie

      i use the following code to delete objects from the cache (configured with JDBCCacheLoader):

      public void clear(String category) {
       for (Object key : cache.findAll(category).keySet()){
       cache.detach(((Fqn)key).toString());
       }
       cache.getCache().getRoot().removeChild(Fqn.fromString(category));
      }
      


      but i see that some of the records are not deleted from the DB.
      If i would like to add the undeleted objects latter.

      How do i solve this?

      i use version JBossCache-all-2.0.0.CR1

        • 1. Re: JDBCCacheLoader does not delete item from table
          Manik Surtani Master

          Is it just the DB that it is not removed from? What happens when you query the cache directly (not via PojoCache)?

          • 2. Re: JDBCCacheLoader does not delete item from table
            gmeroz Newbie

            can you explain how to do it?
            if i use pojoCache.getCache().getMembers(), i get an empty list...

            By the way, deleting the cahce with the exmaple i gave on my previous post, takes a long time (because of the for loop). When running on JBoss with transactions, it may cause a transaction timeout which cause this problem as well.
            Is there a way to make it be deleted faster?

            • 3. Re: JDBCCacheLoader does not delete item from table
              Manik Surtani Master

              getMembers() returns the member addresses of caches in the cluster. Nothing to do with the data set.

              Just pring out the cache to see if there is still stuff in it: System.out.println( pojoCache.getCache() );

              • 4. Re: JDBCCacheLoader does not delete item from table
                gmeroz Newbie

                It is not empty:

                this is the print result:

                12:50:38,642 INFO [STDOUT] ***+++/__JBossInternal__ 0
                 /aag 0
                 /queries 0
                 /d1-3-d2-2-d3-196-d4-0-d5-0-d7-0-d10-0-d11-0-d12-0-d13-0-24-2 0
                 /queryDefinition1-10-SHOW_ALL-7-1 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34agdco-1uj 2
                 /queryDefinition1-null-SIBLINGS-7-56 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34agdg5-1uk 2
                 /queryDefinition1-4-SHOW_ALL-1-1 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34agdj6-1ul 2
                 /d1-4-d2-19-d3-0-d4-0-d5-0-d7-0-d10-0-d11-0-d12-1-d13-4-24-4 0
                 /queryDefinition1-null-LOWEST-7-56 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34a7v5l-1pw 2
                 /queryDefinition1-10-SHOW_ALL-7-1 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34a7ucy-1pu 2
                 /queryDefinition1-null-SIBLINGS-7-56 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34a7v3v-1pv 2
                 /queryDefinition1-4-SHOW_ALL-1-1 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34a7v87-1px 2
                 /d1-3-d2-4-d3-0-d4-0-d5-0-d7-2-d10-0-d11-0-d12-0-d13-0-24-3 0
                 /queryDefinition1-null-LOWEST-7-56 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34abkxc-1r2 2
                 /queryDefinition1-10-SHOW_ALL-7-1 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34abkpj-1r0 2
                 /queryDefinition1-null-SIBLINGS-7-56 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34abkvm-1r1 2
                 /queryDefinition1-4-SHOW_ALL-1-1 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34abkzj-1r3 2
                 /d1-4-d2-0-d3-0-d4-0-d5-0-d7-4-d10-0-d11-2-d12-1-d13-1-23-2 0
                 /queryDefinition1-null-LOWEST-7-56 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34bq4iw-2g2 2
                 /queryDefinition1-10-SHOW_ALL-7-1 0
                 /_ID_ 0
                 /5c4oa2y-kzuv73-f32qcwqd-1-f34bq3zd-2g0 2
                ...
                


                when using the code i gave before for clearing the cache, i used "aag" as a parameter...