Instructor-led training
Fast Track to the Java Persistence API Version 2 (JPA 2) Training in Trotwood, Ohio
As part of the complete overhaul of the Enterprise JavaBeans (EJB) specification, database persistence was broken out into a completely separate specification, the Java Persistence API (JPA).
What you'll learn
Private Training for Teams
This course is offered as private, instructor-led training for organizations, onsite in Trotwood, Ohio or live online. Dates, delivery format, and course content are arranged around your team's requirements.
This course is not currently scheduled as a public class for individual enrollment.
Request Group TrainingPrerequisites
Course Outline
Introduction to Java Persistence API (JPA)
What makes JPA hard to master
The annotations are quick to learn. The difficulty is that JPA hides a stateful system behind them. An entity is not just an object: it is New, Managed, Detached or Removed, and the persistence context decides when changes reach the database. The syllabus builds this up in order.
- Mapping basics first. @Entity, @Id, generated ids, @Basic and @Column, field versus property access, and temporal mappings. Then the EntityManager API, persistence units and find().
- Queries next. JPQL, named queries, parameters, projection, aggregates and bulk update and delete. A common misconception is that JPQL is SQL against tables. It queries the object model, and the course separates it from native SQL with result mapping.
- Lifecycle and concurrency. Transactions (including JTA versus resource-local), persistence context lifespan and propagation, synchronization, @Version with optimistic locking, and lifecycle callbacks. Behavior with detached instances is where many production bugs start.
- Relationships. 1-1, 1-N, N-1 and N-N, unidirectional versus bidirectional, the owning side, cascading with orphanRemoval, lazy versus eager loading, and inner, outer and fetch joins. Most people find the owning side and fetch strategy the hardest part.
- Structure and the Criteria API. Embeddables, compound keys, the three inheritance strategies with their trade-offs, element collections, and the JPA 2 Criteria API (CriteriaBuilder, CriteriaQuery, Predicate, Subquery).
Who it suits and what to take around it
This is an introductory, three-day course for Java developers who need to read and write persistence code against relational databases. One year of Java experience is preferred. Familiarity with SQL and JDBC helps, since the opening module places JPA relative to persistence layers, ORM and JDBC. The description says the content also suits users of the 1.0 release. Developers who need a stronger Java base first can start from the Java Programming courses and learning guide.
The integration modules (DAOs with Java SE, EJB session beans with container-managed entity managers, web applications, and Spring) are marked optional in the syllabus. If your target is container-managed persistence, the Fast Track to EJB 3.2 (JEE 7 level) and JPA2 course is a natural next step. It adds the EJB side to the persistence topics. If you then expose entities as web services, Developing RESTful Services Using Java Version 2.0 covers that layer.
Organizations working with specific Java or persistence versions can ask about customized private training, delivered onsite or live online, through a training proposal request.
Illustrative scenarios
The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.
- Order management. A team might model an order with line items as a bidirectional one-to-many relationship. This touches the owning side, cascading, orphanRemoval, and a fetch join so a list screen does not load line items row by row.
- Concurrent edits. A team might let users edit a record in a form while others change it. Detached instances, @Version and optimistic locking decide whether the second save fails cleanly or silently overwrites the first.
- Search and reporting. A team might build a search screen with optional filters using the Criteria API and Predicates. Beside it, aggregate and projection JPQL queries could feed summary reports, with named queries for the stable ones.
AI coding assistants with JPA
AI coding assistants are useful for boilerplate: entity classes with @Id and @Column, embeddables, simple JPQL and named queries, and first drafts of DAO classes. They also help translate a table design into annotations.
They fail where JPA behavior depends on context the assistant cannot see:
- Bidirectional relationships generated without a clear owning side, or with cascade settings that delete more than intended.
- Fetch strategies that look correct but trigger extra queries or lazy-loading errors outside a transaction.
- Persistence context and transaction assumptions in the wrong place, such as mixing resource-local and JTA patterns, or treating detached entities as managed.
- JPQL strings that compile but fail at runtime, and Criteria code that is verbose and subtly wrong.
- Annotation packages or API usage that do not match the persistence version in your project.
To verify, turn on the provider's SQL logging (a topic in the mappings module) and read the statements actually issued. Run tests against a real database, check entity state transitions explicitly, and write a test that forces an optimistic-lock conflict. Review generated cascade and fetch settings line by line.
Frequently asked questions
What level is this course?
Introductory. It starts with persistence layers, ORM and JDBC, then moves through mappings, queries, lifecycle, relationships, inheritance, the Criteria API and best practices over three days.
What should I know beforehand?
One year of Java programming experience, or equivalent, is preferred. Basic familiarity with relational databases and SQL is useful for the query and mapping topics.
Does it cover JPA 2 features, or only the basics?
The syllabus includes the JPA 2 items: generic queries, orphanRemoval, element collections, the Criteria API and Bean Validation. The description also says it suits users of the 1.0 release.
Are EJB and Spring integration covered?
The syllabus has optional integration modules covering Java SE with DAOs, EJB session beans with container-managed entity managers, Java web applications, and Spring. The core of the course is JPA itself.
Can this be delivered privately and customized?
Yes. HSG delivers private training for organizations onsite or live online, and content can be customized, including to the technology versions your team uses. Use the training proposal request to describe your needs.
Training locations
Fast Track to the Java Persistence API Version 2 (JPA 2) training across the U.S. and beyond.
We provide private Fast Track to the Java Persistence API Version 2 (JPA 2) training for organizations, onsite at your location or live online, throughout the United States and internationally.
View all Fast Track to the Java Persistence API Version 2 (JPA 2) training locations
Train your team with HSG
Private, instructor-led training customized for your organization.
- Onsite or live online delivery
- Customized curriculum
- For a single employee or an entire team
- Flexible scheduling
- Experienced instructors
Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com
Ready to train your team?
Let's customize this training for your organization.
Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.