This page contains information and reference about the following topics/questions/how to's

  1. Why JPA
  2. JPA Architecture Overview and Topics
  3. Policies and Governance
  4. What to expect from this tutorial
  5. Where do I go if I have more questions
  6. Can I use JPA in my batch jobs
  7. How can I unit-test

Architecture Overview

JPA Architecture

See Java Persistence API Architecture:

The diagram below illustrates the relationships between the primary components of the JPA architecture.

Primary Compenents of the JPA Architecture

ORM (Object-Relational Mapping)
Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.

JPA (Java Persistence API)
The Java Persistence API, sometimes referred to as JPA, is a Java programming language framework managing relational data in applications using Java Platform, Standard Edition and Java Platform, Enterprise Edition.

Why ORM or JPA?

This tutorial includes the basic required topics you need to know when using JPA, for in depth explanation of each topic please consult the web, books, and your colleages

DAO and Webapp Security (via Spring Security)
Security is an integral part of every application. Currently we are in the process of standardizing Spring Security usage within ACT

  • Work in progress (TBD)
  • Spring Security will be required and enforced on the DAO layer of your application

Spring/JPA/Hibernate Versions

  • refer to the Libraries Section

JPA Vendor/Provider

  • How do various JPA vendors differ from each other
    • The popular ones (Hibernate/EclipseLink/OpneJPA) try to implement the core functionality of the latest JPA Spec
    • EclipseLink was the reference implementaiton for JPA 2.0 hence had most of the core functionality before the others but since then others have caught up
    • Some Vendors add their own cutom APIs on top of JPA
      • Enforcement: We are NOT recommending and are prohibiting the use of API that is not part of JPA API, consult with your group before using such API
  • How often do I need to update the vendor libraries
    • various JPA vendorshave different release schedules
    • some like Hibernate have frequent release updates
  • JPA Implementaiton: Hibernate is used for all of our guides and configurations through out this documentation
  • Java Bean Validation API (jsr-303): Hibernate Implementation of jsr-303 is used for all of our guides and configurations through out this documentation
  • For any other JPA or Validation Vendor please consult with your Group's Manager
  • What if I find or suspect a bug with my JPA vendor in use
    • ask on Spring/Oracle/Hibernate forums or solution trackers like Stack Overflow's knowledge base
    • please create a bug/JIRA ticket for the vendor
      • Hibernate's Issue Tracker:

Best Practices

  •  See each section for the overview and best practices


  • Best practices should be enforced in various stage of your design and also code review
  • Use this tutorial as a checklist when performing code reviews


  • some but not all advanved topics are mentioned in this tutorial
    • please consult web, books, ,and your colleages for topic not mentioned here


Questions & How To's

What to expect from this tutorial 

The goal of this tutorial

  • Assist you on learning/configuring JPA and Spring
  • Show you how to configure your server
  • Familiarize you with the basic JPA concepts
  • Familiarize you with the best practices when using JPA
  • Be used as a checklist when performing code reviews
  • This tutorial is NOT meant to teach you JPA but to rather assist you when learning and put you in the right track

Where do I go if I have more questions 

Since JPA is open-source, standard and part of standard Java EE stack, there are plenty of community support 

  • If you cannot find what you are looking for consult on-line forums
  • If you think you have found bugs submit a ticket to the corresponding JPA Vendor's ticketing system
  • Consult your colleage
  • Share your knowledge via ACT workshops or TeamForge forums
  • We are open to suggestoins 

Can I use JPA in my batch jobs 

Certainly, at the moment we do NOT provide a different setup than the web-app setup

  • We reommend setting your batch job simliar to a Spring web-app and use the Spring unit-testing configuration loader (see unit-test section) to implement your batch job
    • Spring abstracts away a lot of the things that you have to implement manually if you were to use JPA alone
  • You can certainly setup your batch job without Spring
    • As mentioned above, currently we do not provide a stand-alone batch setup

How can I unit-test 

Unit-testing is a big part of application development and Quality Assurance. JPA and Spring can help you unit-test your application easilty

  • please consult the unit-testing section for a brief introduction