5 Data Access with JPA Using Spring
WHAT YOU WILL LEARN IN THIS CHAPTER:
- Introducing the ORM world
- Learning the role of JPA and what Spring offers
- Configuring and using Spring's JPA support
- Making use of PersistenceContext and PersistenceUnit annotations
- Learning the role of JpaDialect and load-time weaving in JPA configuration
- Properly handling and translating ORM exceptions
Object-oriented programs deal with hierarchies of objects. They create objects; make associations between objects; modify their attributes; and so on. At some point they need to store states of those objects so that those objects can later be restored with the saved state. This state is usually kept in relational databases as records in tables. Enterprise applications, therefore, use data access strategies; for example, Java Database Connectivity (JDBC) fetches the data in a relational database, processes it in the application layer, and shows it to their users, or it accepts some data from a user, processes it again, and stores it in the database using JDBC. Hence, some sort of translating between objects and relational data is continuously performed in such systems. Object-relational mapping (ORM) tools try to automate this translation process and let developers ...
Get Beginning Spring now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.