Gemfire - Crud Repository - findBy Implementation

99 views Asked by At

We are using single Gemfire cluster for all non production environment and geting regionname dynamically using @Resources. To use we need to override all the CRUD operation. I got struck implementation the logic for findByFirstNameAndLastName(String firstName,String lastName).

Can anyone share actual implementation of findBy in CrudRepository.

Appreciate your help.

1

There are 1 answers

0
Vigneshwaran On
public List<User> findByFirstName(String firtstName) throws QueryException {
              List<User> user = new ArrayList<>();
              try {
                     SelectResults<User> results = (SelectResults) userRegion
                                  .query("select * from /" + userRegion.getName() + " d where d.firtstName='" + firtstName+"'");
                     user.addAll(results);
              } catch (FunctionDomainException | TypeMismatchException | NameResolutionException
                           | QueryInvocationTargetException e) {
                     throw e;
              }
              return user;
       }