Showing posts with label JPA. Show all posts
Showing posts with label JPA. Show all posts

April 12, 2013

Introducing EclipseLink JPA-RS

In a previous series of posts I covered how to create a JAX-RS service that leveraged JPA for the persistence layer.  EclipseLink contains a component called JPA-RS that can be used to easily and automatically expose a persistence unit as RESTful service (that supports XML and JSON messages).  MOXy provides the XML and JSON-binding for JPA-RS and things like bidirectional mappings are automatically mapped for you.  In another post I cover how MOXy can be used to customize the messages shown in this example.

I will use the JPA model that I created in the posts below:

April 17, 2012

Creating a RESTful Web Service - Part 2/5 (XML Metadata)

Java Persistence Architecture (JPA) is the Java EE standard for mapping POJOs to a relational database. In this example we will use JPA to interact with our database data we set up in part 1.  In the previous post we specified the mapping metadata as annotations.  This post will demonstrate how to specify the same metadata as XML.  One advantage of specifying the metadata as XML is that the domain objects will not have a dependency on the JPA APIs.  This is useful if we want to use the same domain classes on the client side.


June 24, 2011

Using JAXB's @XmlAccessorType to Configure Field or Property Access

JAXB offers a lot of flexibility when interacting with your object model.  One area is configuring the use of fields or properties to access the data in your domain objects.  This is specified as an XmlAccessType (PUBLIC_MEMBER, PROPERTY, FIELD, or NONE) via the @XmlAccessorType annotation.  In this post we'll examine what these options really mean.

August 19, 2010

Creating a RESTful Web Service - Part 2/5 (Annotations)


Java Persistence Architecture (JPA) is the Java EE standard for mapping POJOs to a relational database. In this example we will use JPA to interact with our database data we set up in part 1.

July 26, 2010

JPA Entities to XML - Bidirectional Relationships

JAXB is your best choice when binding Java objects to XML.  But what happens when those Java objects turn out to be JPA entities?  For the most part it is business as usual, although there are a couple things to be aware of.  In this post we'll cover a MOXy extension that can be used to map a bidirectional relationship.