3 Replies Latest reply on Mar 23, 2010 6:36 AM by Nicolas Gillet

    Custom column in jbosscache table and Custom Loading from pe

    Sreedhar C Newbie


      I am working on integration of jbosscache and gridgain.

      While using "JDBCCacheLoader" , the current implementation contains three columns (FQN,VALUE,PARENT)

      Is it possible to have a userdefined column (say LoadKey) which can have some user defined value (say an integer value) which can be persisted along with jboss cache in to the database.

      and while loading the jboss cache is it possible to :

      On grid node1, load jboss cache based on the condition that LoadKey is between 1 to 10000 and on grid node2 load another jboss cache based on the condition that LoadKey is between 2 to 20000 etc...

        • 1. Re: Custom column in jbosscache table and Custom Loading fro
          Manik Surtani Master

          Sure - you could have your own cache loader impl that does that.

          • 2. Re: Custom column in jbosscache table and Custom Loading fro
            Jorge Morales Master

            Hi,
            Since JBC 3.1.0.GA JDBCCacheLoader is easily subclassable per this request, So you only need to subclass JDBCCacheLoader and JDBCCacheLoaderConfig, and redefine the methods you need, like:

            JDBCCacheLoaderConfig.constructCreateTableDDL()
            JDBCCacheLoaderConfig.constructUpdateNodeSql()
            JDBCCacheLoaderConfig.constructInsertNodeSql()
            JDBCCacheLoader.processConfig()
            JDBCCacheLoader.populatePreparedStatementForInsert()
            JDBCCacheLoader.updateNode()


            Hope this helps. We are doing almost the same

            • 3. Re: Custom column in jbosscache table and Custom Loading fro
              Nicolas Gillet Newbie

              Hello,

               

              I am new in JBoss Cache world and I am looking for a way to write my own jdbcCacheLoader.

               

              Jorge's previous message gave me some hint but it is still blurry to me.

              Is there any tutorial or example of such customized cache loader?

               

              I especially have trouble to see how my jdbcCacheLoader will use my jdbcCacheLoaderConfig and how this jdbcCacheLoaderConfig il initialized and also if I will have to hard-code additionnal columns or if the mapping can be automatic through the configuration file.

               

              I need to store geo-referenced images. Right now the whole object (image binary and infos) is stored as a blob but I would like to separate the different fields (coordinates, creation date and so one).

               

              Thanks for any input.

               

              Nicolas

              Gillet

               

              P.S. sorry to unbury old topics