Spring Data

996 views
855 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
996
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Spring Data

  1. 1. SPRING DATA THE LIGHTEST DATA ACCESS Jakub Kubrynski jkubrynski@gmail.com www.kubrynski.com
  2. 2. AGENDA ------------------------------------------- - basics - core - missing 5 percent - polyglot persistence - live coding - questions
  3. 3. WHAT IS SPRING DATA ------------------------------------------- - Umbrella project - Repositories done right - no boilerplate - CRUD on steroids - Declarative query methods - magic finders - Different technologies - single API
  4. 4. MAIN ELEMENTS ------------------------------------------- - CrudRepository - Save(..), exists(..), delete(..) - findOne(id), findAll(), findAll(..) - Count() - PagingAndSortingRepository
  5. 5. QUERY PATTERNS ------------------------------------------- - ^(find | read | get | count)*By - „By” acts as a delimiter between Subject and Predicate - findByFieldPropertyName
  6. 6. QUERY PATTERNS ------------------------------------------- public interface UserRepository extends... User findByLogin(String login); User findByFirstNameAndLastName (String fname, String lname);
  7. 7. QUERY BLOCKS ------------------------------------------- - GreaterThan / LessThan - Like - Between - In - IsNull / IsNotNull - And / Or
  8. 8. QUERY EXAMPLES ------------------------------------------- - findDistinctByFirstname - find*AllIgnoreCase, find*IgnoreCase - countByUser_lastname - findByLastnameOrderByFirstnameDesc
  9. 9. PAGING AND SORTING ------------------------------------------- - PageRequest - Contains page size and offset - Page - Total number of elements and pages - Sort - List of properties and directions
  10. 10. CRITERIA QUERY ------------------------------------------- - Specifications - JpaSpecificationExecutor + Predicate - We can avoid repository method explosion - Not so beatiful code
  11. 11. QUERY DSL ------------------------------------------- - AnnotationProcessor - querydsl-maven-plugin - QueryDslPredicateExecutor - query.from(qAddress) .where(qAddress.city.eq(„Warsaw”))
  12. 12. ADDITIONAL FEATURES ------------------------------------------- - Auditable entities - AuditorAware - Custom methods implementation - Custom repositories - RepositoryFactoryBeanSupport - Caching - REST exporter
  13. 13. POLYGLOT PERSISTENCE ------------------------------------------- - Relational / JPA - MongoDB, Redis, Couchbase - Solr, ElasticSearch - Hadoop, Hbase - Neo4j - GemFire
  14. 14. DEMO ------------------------------------------- time for coding
  15. 15. QUESTIONS -------------------------------------------
  16. 16. THANK YOU! :-)

×