6 Replies Latest reply on Jun 13, 2008 11:11 AM by Jason Greene

    Persistence

    Tony Thompson Newbie

      I am using the file cache loader to persist my POJOs to disk for testing. I am doing something like this:

      obj = cache.find( fqn );
      if( obj == null ) {
      obj = new X();
      cache.attach( fqn, obj );
      }

      obj.setBlah( "blah" );

      I do see my X object written out to disk but if I kill my process and restart it, all of the fields of X are back to defaults. So, I would expect something like:

      obj.getBlah();

      to return "blah" but it returns null. Am I missing a step? Should any updates I make to "obj" be persisted as well?

      A somewhat unrelated question....if I persist to a DB, does it serialize the whole object when an update is made or does it just persist the fields that are changed like during replication? It would appear the file cache loader writes the whole object every time (well, not for me right now) which could be fairly inefficient.

      Thanks
      Tony