1 Reply Latest reply on Jun 19, 2007 9:45 AM by Noga Tor

    Pojo Cache Transaction Problematic behaviour

    Noga Tor Newbie

      Hi

      Im using the following code for PojoCahce replication between 2 JVMs.
      (version 1.4.0)
      The scenario is as follows:


      Step 1
      =====

      JVM1 handles the User first (within transaction):

      -------------------------------
      code (passes successfully):
      -------------------------------


      UserTransaction userTransaction = null;

      Properties prop = new Properties();

      prop.put(Context.INITIAL_CONTEXT_FACTORY,org.jboss.cache.transaction.DummyContextFactory.class.getName());

      InitialContext initialContext = new InitialContext(prop);

      userTransaction = (UserTransaction)initialContext.lookup"UserTransaction");

      userTransaction.begin();

      User user = new User();

      pojoCahce.put(new Fqn("/user"),user);

      user.setId("1");
      user.setName(""myUser");

      userTransaction.commit();





      Step 2
      =====

      JVM2 now attempts to fetch the User from its cache:

      -------------------------------------
      code (within transaction as well)
      -------------------------------------

      User user = (User)pojoCahce.get(new Fqn("/user"));
      String name = user.getName() \\returns null


      The User instance is indeed there, however all its members (updated by JVM1) are null, consequently failing the action due to lack of information.




      why does this happen?
      Am I doing something wrong?


      Thanks in Advance
      Noga