4 Replies Latest reply on May 24, 2017 12:06 AM by wolframite

    Reading an item from a JPA backed remote cache returns null

    wolframite

      I'm using 9.0.0 Final embedded client/server talking to each other via Hot Rod.

       

      Keys set by the client can be read back, but keys which are still in the database are not transferred over.

      I wrote a test client to demonstrate the behaviour:

       

      Configuration config = new ConfigurationBuilder().addServer().host("localhost").port(11222).build();
      RemoteCacheManager remoteCacheManager = new RemoteCacheManager(config);
      RemoteCache<String, Object> remoteCache = remoteCacheManager.getCache("main");
      
      log.info("Size: {}", remoteCache.size());
      for (String key : remoteCache.keySet()) {
         log.info("Key: {}", key);
         log.info("Kontainski: {}", remoteCache.containsKey(key));
         log.info("Value: {}", remoteCache.get(key));
      }
      

       

      That's the result:

       

      Size: 3
      
      Key: hallo
      Contains Key: true
      Value: test
      
      Key: hallo3
      Contains Key: true
      Value: 12.5
      
      Key: hallo5
      Contains Key: false
      Value: null
      
      
      
      

       

      The key hallo5 is in the database and I can retrieve it when I'm on the server like this:

      embeddedCacheManager.getCache("main").get("hallo5");
      

       

      Here's my persistence configuation on the server:

      primaryCacheConfigurationBuilder.persistence()
          .passivation(false)
          .addStore(JpaStoreConfigurationBuilder.class)
              .shared(true)
              .preload(false)
              .persistenceUnitName(readthroughPersistenceUnitName)
              .storeMetadata(false)
              .entityClass(entityClass)
              .ignoreModifications(true);
      

       

      Any hints are welcome :-)