2 Replies Latest reply on Oct 16, 2012 5:56 PM by ajcmartins

    Unwanted automatic update of entities..

    ajcmartins Newbie

      Hey, i have spent so much time around this that i can no longer even understand if this is the default behavior:

       

      I have a simple entity that i get from a cache as follows:

       

       

      ...

      @Inject

      @PersonsCache

      Cache<String, Person> cache;

       

       

      public Person getPerson(String name){

           return cache.get(name);

      }

      ...

       

      Then at a different part of the program i change the age property to something. Everything works as it should, except if i search the same entity using the same method above, the entity will have the age property changed, despite me not having done any update on the cache like cache.put(....). Using Lucene to make a query also returns the entity updated..

       

      Is this the default behaviour? It doesn't feels right and from what i readed on the docs it shouldn't be.. Any idea why this may be happening or how can i make it to not persist the changes?

       

      Note: Using infinispan-cdi 5.2.0Beta2 and JBoss 7.1.1Final.

       

      Cheers,