Upload
spring-io
View
112
Download
1
Embed Size (px)
Citation preview
Spring Data HazelcastFluently Accessing Distributed Repositories
By Viktor Gamov / Neil Stevenson@gamussa / @hazelcast
What’s is Hazelcast
• Distributed Java Collections (Map, Set, List, Queue)• NoSQL in-memory store - <K,V>• Scalability and Resilience for free• Spring support out-of-the-box
4
Why Spring Data Hazelcast
• Started by Oliver Gierke & Christoph Strobl 👏• Familiar "Spring Data" approach,
• developers do not need to learn a new technology to be able to use it• Utilizes the new Spring-Data-Key value abstraction• Reduces vendor lock-in
• One can swap Hazelcast in place of more expensive or slower options• FURTHER eases the integration of Hazelcast into Spring and clouds
6
MOAR Queries!
9
public interface PersonRepository extends HazelcastRepository<Person, String> {
public Long countByFirstname(String firstname);
public Long countByIdLessThanEqual(String id);
public Long countDistinctLastnameByFirstname(String firstname);
public Person deleteByLastname(String firstname);
public Person findFirstIdByOrderById();
public Person findFirstIdByFirstnameOrderByIdDesc(String firstname);
public List<Person> findByFirstname(String firstname);
public List<Person> findByFirstname_AndLastname(String firstname, String lastname);
public List<Person> findByFirstnameOrLastname(@Param("lastname") String s1, @Param("firstname") String s2);
public List<Person> findByFirstnameGreaterThan(String firstname);
public Page<Person> findByLastname(String lastname, Pageable pageable);
public Page<Person> findByOrderByLastnameDesc(Pageable pageable);
public Slice<Person> findByIdLike(String pattern, Pageable pageable);
Resources
• Project home https://github.com/hazelcast/spring-data-hazelcast• This demo https://github.com/gAmUssA/springoneplatform-demo• More Hazelcast Demos https://github.com/hazelcast/hazelcast-code-samples/
10