0 Replies Latest reply on Oct 10, 2006 4:55 AM by tvfj5f!

    JDBCCacheLoader not working with POJOCache

    tvfj5f!

      Hi,

      I have configured JDBCCacheLoader with POJOCache , but the CacheLoader is not persisting the cache in the database.
      My Jboss Cache version is 1.4. And I am using MySQL as database.

      The configuration code is as follows:




      <!-- if passivation is true, only the first cache loader is used; the rest are ignored -->
      <!-- Enabling the activation\passivation -->
      true
      <!-- comma delimited FQNs to preload -->
      /
      <!-- are the cache loaders shared in a cluster? -->
      false

      <!-- we can now have multiple cache loaders, which get chained -->
      <!-- the 'cacheloader' element may be repeated -->

      org.jboss.cache.loader.JDBCCacheLoader
      <!-- same as the old CacheLoaderConfig attribute -->

      cache.jdbc.table.name=jbosscache
      cache.jdbc.table.create=true
      cache.jdbc.table.drop=false
      cache.jdbc.table.primarykey=jbosscache_pk
      cache.jdbc.fqn.column=fqn
      cache.jdbc.fqn.type=varchar(255)
      cache.jdbc.node.column=node
      cache.jdbc.node.type=longblob
      cache.jdbc.parent.column=parent
      cache.jdbc.driver=com.mysql.jdbc.Driver
      cache.jdbc.url=jdbc:mysql://localhost:3306/tg_schema
      cache.jdbc.user=root
      cache.jdbc.password=passw0rd#

      <!-- whether the cache loader writes are asynchronous -->
      false
      <!-- only one cache loader in the chain may set fetchPersistentState to true.
      An exception is thrown if more than one cache loader sets this to true. -->
      true
      <!-- determines whether this cache loader ignores writes - defaults to false. -->
      true
      <!-- if set to true, purges the contents of this cache loader when the cache starts up.
      Defaults to false. -->
      false







      The cacheable objects are serializable.


      The code for building the cache is :

      private PojoCache pojoCache;
      pojoCache.putObject(fqn,cacheObj);


      I am able to build the cache but CacheLoader is not persisting it in the database. I am not getting any clue as whree could things go wrong.

      P.S. Instead of PojoCache's putObject if I use TreeCache's put method.

      i.e.

      pojoCache.put(fqn,regionName ,cacheObj);

      then the persistence happens. Does this mean that org.jboss.cache.aop.PojoCache does not support CacheLoaders.

      Please help.

      Thanks