jOOQ makes a step forward towards JPA


With the upcoming release 1.6.4 and the implementation of #198, jOOQ will start to better integrate in “standard” J2EE architecture. While jOOQ is being developed as an alternative to JPA, it should not compete with it. This means that there are some parts in JPA which can easily co-exist with jOOQ in a J2EE application:

For this purpose, jOOQ will interface the fetching of org.jooq.Result with JPA-annotated entites. This interface can be accessed as of release 1.6.4 in any of these types:

public interface ResultQuery {
    // [...]

    // Fetch results directly into a list of your custom annotated entity
    <E> List<E> fetchInto(Class<? extends E> type) throws SQLException;
}

public interface Result {
    // [...]

    // Copy existing results into a list of your custom annotated entity
    <E> List<E> into(Class<? extends E> type);
}

public interface Record {
    // [...]

    // Transform a single record into your custom annotated entity
    <E> E into(Class<? extends E> type);
}

The above API extension shows how easily JPA-annotated types can be integrated in jOOQ. With any of these methods, you can use jOOQ’s fluent querying API to execute complex queries, and then further process your data using your own POJO‘s, which can be further modified and persisted using your favourite JPA implementation’s EntityManager. But most importantly, your POJO’s will have no dependency on jOOQ anymore, unlike today’s org.jooq.Record. Even better, this will also work with non-annotated types, where jOOQ will try to match Record fields against Class members and methods by a common naming convention.

A snapshot preview of version 1.6.4 can be seen on the Sonatype Maven repository:

https://oss.sonatype.org/content/repositories/snapshots/org/jooq/

Tags: , ,

Trackbacks / Pingbacks

  1. The Ollin Framework « Java, SQL, and jOOQ - August 2, 2011

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 2,083 other followers

%d bloggers like this: