Weitere ähnliche Inhalte
Ähnlich wie Spring Data JDBC: Beyond the Obvious (20)
Mehr von VMware Tanzu (20)
Kürzlich hochgeladen (20)
Spring Data JDBC: Beyond the Obvious
- 1. Confidential │ ©2021 VMware, Inc.
Spring Data JDBC
Beyond the Obvious
Jens Schauder (he/him)
Spring Data
Year 2 of the Pandemic
- 2. Confidential │ ©2021 VMware, Inc. 2
This presentation may contain product features or functionality that are currently under
development.
This overview of new technology represents no commitment from VMware to deliver these
features in any generally available product.
Features are subject to change, and must not be included in contracts, purchase orders, or
sales agreements of any kind.
Technical feasibility and market demand will affect final delivery.
Pricing and packaging for any new features/functionality/technology discussed or
presented, have not been determined.
The information in this presentation is for informational purposes only and may not be incorporated into any contract. There is no
commitment or obligation to deliver any items presented herein.
Disclaimer
- 9. Confidential │ ©2021 VMware, Inc. 9
User Defined IDs
Use
• JdbcAggregateTemplate.insert
• Or a BeforeSaveCallback
- 11. Confidential │ ©2021 VMware, Inc. 11
JSON / Custom Conversions
• Use a custom type
• Register custom converters
• Don’t forget @ReadingConverter /
@WritingConverter
- 13. Confidential │ ©2021 VMware, Inc. 13
Bidirectional Relationships (internal)
Set the backreference whenever adding an
inner entity.
- 14. Confidential │ ©2021 VMware, Inc. 14
Bidirectional Relationships (external)
Use a custom query on the repository.
- 16. Confidential │ ©2021 VMware, Inc. 16
Caching
Use Springs existing caching abstraction on
the repository.
- 18. Confidential │ ©2021 VMware, Inc. 18
Eager Loading References
Create an entity defining the required
combination of aggregates (or their pieces)
Use a dedicated repository or custom
queries to load it.
You may want to “persist” the query as a
database view.
- 19. Confidential │ ©2021 VMware, Inc. 19
Resources
Source: https://github.com/schauder/talk-beyond
SD JDBC: https://github.com/spring-projects/spring-data-jdbc
Required Reading:https://spring.io/blog/2018/09/24/spring-data-
jdbc-references-and-aggregates
SO: https://stackoverflow.com/questions/tagged/spring-data-jdbc
Twitter: https://twitter.com/jensschauder