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
by the way, I forgot to mention it, but this code works when I ommit the tranasction code.
This is how I know the transaction is the thing that causes the problematic behaviour