[jboss-user] [JBossCache] - Pojo Cache Transaction Problematic behaviour

nogator do-not-reply at jboss.com
Tue Jun 19 08:58:37 EDT 2007


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4055603#4055603

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4055603



More information about the jboss-user mailing list