1

考虑一个类 Person,它有 3 个属性 { id ,name ,age } id 形成为 name||age。获取查询仅按 Id 工作(在创建记录的同一事务中)

 @Transactional
public void test(String id,String id2 ) {
 personService.save(new Person("abc","123"));
 Person person = repository.findByNameAndAge("abc", "23"); //doesn't work in same transaction
    //however find by Id column works in same transaction works
    repository.findOne("abc||23") 
    }

从另一个事务调用 repository.findByNameAndAge("abc", "23")返回结果,但在创建该记录的同一事务中,它不返回任何结果。

这里的存储库是

 public interface PersonRepository extends GemfireRepository<RecordRevision, String> {
           List<Person> findByNameAndAge(String name, String age);

这些区域是 REPLICATE_PERSISTENT 并且我正在使用 PDX 序列化即使在同一个事务中调用也应该有效,这是任何已知问题吗?

4

1 回答 1

0

这是 GemFire [[1]] 中的一个已知限制。查询引擎看不到事务状态。按 id 查找被转换为 GemFire region.get() ,它能够查看事务状态。

[1] http://gemfire.docs.pivotal.io/docs-gemfire/latest/developing/transactions/working_with_transactions.html#concept_ty1_vnt_vk

于 2016-07-08T16:10:14.623 回答