Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JavaFest. Taras Boychuk. There is always a choice. Spring Data JDBC vs. Hibernate

A relational database is still an industry standard for data persistence, while Hibernate is Java-framework #1 for building a persistence layer of our apps. Its features like Persistence Context, Dirty Checking, Lazy Loading, Action Queue, and Flush bring so much power... And so much complexity. There is literally no way to make Hibernate a simple lightweight framework. No worries, if you don't want to deal with complexity. There is always a choice. Spring Data JDBC is a super-simple framework that perfectly fits into your Spring application and brings you almost no magic. It's simple, predictable, and straightforward. And it's your new option for building a persistence layer.

  • Be the first to comment

  • Be the first to like this

JavaFest. Taras Boychuk. There is always a choice. Spring Data JDBC vs. Hibernate

  1. 1. 1 Hibernate vs. Spring Data JDBC Taras Boychuk
  2. 2. 2
  3. 3. 3 Thank you 🤗
  4. 4. 4 Let’s have fun 😀
  5. 5. 5 🙋Taras Boychuk ⛰ 👨💻 👨🏫 📚 🇺🇦
  6. 6. 6
  7. 7. 7 💁
  8. 8. 8 • Brief ORM overview • Hibernate coding session • Spring Data JDBC coding session • Conclusion Agenda
  9. 9. 9 Spring Data JDBCvs. 2001 2018
  10. 10. 10 ORM
  11. 11. 11
  12. 12. 12 enterprise app
  13. 13. 13 Spring Boot Spring Data JPA
  14. 14. 14 Let’s check out the code 💻
  15. 15. You should always know the session boundaries 🏁
  16. 16. • 1-level cache • Lazy loading • Dirty checking • Orphan removal Application ⛔ ⛔ ⛔ ⛔ Session ✅ ✅ ✅ ✅
  17. 17. Event Listener Action Action Queue
  18. 18. 😱
  19. 19. 19 Session Persistence Context Action Queue Entities states SQL queries
  20. 20. Event Updates Persistence Context Creates an Action (SQL) 🔥 Event
  21. 21. 21 Action Queue flush() DB 🤔
  22. 22. 22 1. OrphanRemovalAction 2. EntityInsertAction or  EntityIdentityInsertAction 3. EntityUpdateAction 4. CollectionRemoveAction 5. CollectionUpdateAction 6. CollectionRecreateAction 7. EntityDeleteAction 😲 Action Queue Order
  23. 23. Entity Snapshot copy Object[] Dirty checking
  24. 24. 24 Persistence Context Lazy Loading Dirty Checking Cascade Operations Orphan Removal Action Queue Flush
  25. 25. 25 You couldn't imagine Hibernate complexity if you didn't dive into it 😔
  26. 26. 26 There is always a choice – Spring Data JDBC
  27. 27. Spring Data JDBC 🤷 simple & lightweight alternative to JPA Session Lazy Loading Dirty Checking
  28. 28. 28 Let’s check out the code 💻
  29. 29. Spring Data JDBC • based on the idea of Aggregate Root (Domain Drive Design) • supports Spring Data CRUD repository • supports @Query (native) • straightforward • fast
  30. 30. 30 Which one will you choose?
  31. 31. 31
  32. 32. 32
  33. 33. 33
  34. 34. Spring Data JDBC
  35. 35. Confidential 35 z
  36. 36. 36 2003
  37. 37. 37 Spring Data JDBC
  38. 38. 38 Tools don't make a difference, but people do
  39. 39. 39 See you

×