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/Like this:
Like Loading...
Published by lukaseder
I made jOOQ
View all posts by lukaseder