Geode/Gemfire OQL';s的返回数据在事务视图中不正确
您好,我向一个区域插入了一个新条目,并在同一事务中查询了一个OQL(SELECT*FROM/some_region_name),我发现新插入的条目没有在OQL结果中返回。有人知道这是怎么回事吗 以下是我的测试代码:Geode/Gemfire OQL';s的返回数据在事务视图中不正确,gemfire,geode,Gemfire,Geode,您好,我向一个区域插入了一个新条目,并在同一事务中查询了一个OQL(SELECT*FROM/some_region_name),我发现新插入的条目没有在OQL结果中返回。有人知道这是怎么回事吗 以下是我的测试代码: ClientCache cache = (ClientCache) EcnSpringContext.getBean("gemfireCache"); Region<String, RUserEntity> userRegion = (Region&l
ClientCache cache = (ClientCache) EcnSpringContext.getBean("gemfireCache");
Region<String, RUserEntity> userRegion = (Region<String, RUserEntity>) EcnSpringContext.getBean("r_user");
CacheTransactionManager txmgr = cache.getCacheTransactionManager();
EcnGeodeTemplate ecnGeodeTemplate = (EcnGeodeTemplate) EcnSpringContext.getBean("rUserTemplate");
String username = "forrest";
System.out.println("Transaction begin.");
txmgr.begin();
System.out.println("checking username[" + username + "] before added.");
RUserEntity found = (RUserEntity) userRegion.selectValue("SELECT * FROM /r_user WHERE username = '" + username + "'");
if (found == null)
System.out.println("rUserEntity NOT found");
else
System.out.println("rUserEntity found");
RUserEntity rUserEntity = new RUserEntity();
rUserEntity.setUsername("forrest");
rUserEntity.setId(username);
userRegion.put(username, rUserEntity);
System.out.println("checking username[" + username + "] after added.");
found = (RUserEntity) userRegion.selectValue("SELECT * FROM /r_user WHERE username = '" + username + "'");
if (found == null)
System.out.println("rUserEntity NOT found");
else
System.out.println("rUserEntity found");
txmgr.commit();
System.out.println("Transaction end.");
System.out.println("checking username[" + username + "] after transaction.");
found = (RUserEntity) userRegion.selectValue("SELECT * FROM /r_user WHERE username = '" + username + "'");
if (found == null)
System.out.println("rUserEntity NOT found");
else
System.out.println("rUserEntity found");
但不幸的是,我得到了这个结果:
Transaction begin.
checking username[forrest] before added.
rUserEntity NOT found
checking username[forrest] after added.
**rUserEntity NOT found**
Transaction end.
checking username[forrest] after transaction.
rUserEntity found
这是一个已知的限制:
Transaction begin.
checking username[forrest] before added.
rUserEntity NOT found
checking username[forrest] after added.
**rUserEntity NOT found**
Transaction end.
checking username[forrest] after transaction.
rUserEntity found
Queries and indexes reflect the cache contents and ignore the changes
made by ongoing transactions. If you do a query from inside a transaction,
the query does not reflect the changes made inside that transaction.