In this article you will learn how to persist objects using the Java Persistence API (JPA), customize their mapping with annotations, and create a one-to-one relationship. Using the entity lifecycle you will control persistency and use the query language (JPQL) to query your objects.
by Antonio Goncalves
February 1, 2007
bject/relational mapping (ORM)in other words, persisting Java objects to a relational databasehas become a major topic recently, thanks, in part, to a proliferation of advanced methods that attempt to make it easier. Among these various technologies are Entity Beans 2.x, TopLink, Hibernate, JDO, and even JDBC with DAO. Faced with so many incompatible choices, the Java EE expert group took inspiration from these popular frameworks and created the Java Persistence API (JPA), which is suitable for use with Java EE or SE applications.
In a nutshell, the JPA's aim is to bring back the POJO programming model to persistence. Despite the fact that the specification is still bundled with EJB 3, JPA can be used outside the EJB container, and that's the way this article will use it: Plain Old Java Objects running in a Java SE application.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!