I've been playing around with the new Spring-Gemfire project and have gotten most to work pretty smoothly. However, I have run into one problem using the CrudRepository and GemfireRepository interfaces. Let me set up the problem.
Here is my main object being fetched.
Here is my Repository interface with one simple queryCode:@Region("Accounts") public class Account extends AbstractPersistentEntity { private static final long serialVersionUID = 1L; private String name; private String acctNumber; private List<Beneficiary> beneficiaries = new ArrayList<Beneficiary>(); @PersistenceConstructor public Account(Long id, String name, String acctNumber) { super(id); this.name = name; this.acctNumber = acctNumber; }
And... my gemfire configurationCode:public interface AccountRepository extends CrudRepository<Account, Long> { List<Account> findByName(String name); }
Finally, here are my tests. I was able to do some basic fetches and queries using the GemfireTemplate with no problem. But in the last test, I get an exception that seems to boil down to this: Region not found: /AccountssCode:<gfe:client-region id="accountRegion" name="Accounts" data-policy="empty"/> <gfe:pool id="gemfirePool"> <gfe:locator host="localhost" port="41111"/> </gfe:pool> <bean id="gfTemplate" class="org.springframework.data.gemfire.GemfireTemplate"> <property name="region" ref="accountRegion" /> </bean> <gfe-data:repositories base-package="com.vmware.gfdemo.dao" />
I'm honestly baffled as to where it gets the the 'Accountss' region when I've clearly designated it as 'Accounts' in the @Region annotation on the Account class.Code:@Autowired @Qualifier("gfTemplate") private GemfireTemplate accountTemplate; @Autowired private AccountRepository accountRepository; // This works @Test public void testSimpleGet() { Account a = accountTemplate.get(1); assertEquals("Mark", a.getName()); } // This works @Test public void testSearchByName() { SelectResults<Account> results = accountTemplate.find("SELECT * from /Accounts WHERE name=$1","Mark"); assertNotNull("Failed to perform find", results); assertEquals("Fetched incorrect number of results", 1,results.size()); assertEquals("Failed to fetch Mark", "Mark", results.asList().get(0).getName()); } // Fails with exception: // Caused by: com.gemstone.gemfire.cache.query.RegionNotFoundException: Region not found: /Accountss @Test public void testAccountRepository () { List<Account> accounts = accountRepository.findByName("Mark"); assertNotNull("Failed to perform query",accounts); assertEquals("Fetched incorrect number of results",1,accounts.size()); assertEquals("Failed to fetch Mark", "Mark", accounts.get(0).getName()); }
Any ideas? Is this a bug or did I miss something incredibly stupid?
Thanks


Reply With Quote
