JPA2 is an object-relational mapping framework that provides persistence for objects. It allows objects to be stored in and retrieved from a database without writing SQL code. Annotations or XML can be used to map objects and their properties to database tables and columns. Common tasks like inserting, updating, deleting and querying data can be done by interacting with the persistent objects rather than writing SQL statements directly. The document provides examples of mapping a library domain model including books, persons, and loans to a database using JPA2.