Top Description Fields Constructors Methods
org.jooq.impl

public final Class JPAConverter<T, U>

extends AbstractContextConverter<T, U>
Class Inheritance
Imports
java.lang.reflect.Method, jakarta.persistence.AttributeConverter, org.jooq.ConverterContext, org.jooq.exception.MappingException, org.jooq.tools.JooqLogger, org.jooq.tools.reflect.Reflect

A converter that delegates data type conversions to a JPA AttributeConverter.

This is particularly useful when generating code from a JPADatabase, which reverse engineers JPA annotated entities, in case of which, by default, the AttributeConverter annotations are discovered automatically and the user-defined type is applied also in the jOOQ meta model.

Author
Lukas Eder

Field Summary

Modifier and TypeField and Description
private final AttributeConverter<U, T>
private static final JooqLogger

Constructor Summary

AccessConstructor and Description
public
JPAConverter(Class<? extends AttributeConverter<U, T>> klass)

Method Summary

Modifier and TypeMethod and Description
public final U
from(T
The database object.
t
,
ConverterContext
The context of this conversion.
scope
)

Implements org.jooq.ContextConverter.from.

Read and convert a database object to a user object.
private static final <T> Class<T>
fromType(Class<? extends AttributeConverter<?, T>> klass)

public final T
to(U
The user object.
u
,
ConverterContext
The context of this conversion.
scope
)

Implements org.jooq.ContextConverter.to.

Convert and write a user object to a database object.
private static final <U> Class<U>
toType(Class<? extends AttributeConverter<U, ?>> klass)

Inherited from org.jooq.impl.AbstractContextConverter:
toString

Field Detail

delegateback to summary
private final AttributeConverter<U, T> delegate
logback to summary
private static final JooqLogger log

Constructor Detail

JPAConverterback to summary
public JPAConverter(Class<? extends AttributeConverter<U, T>> klass)

Method Detail

fromback to summary
public final U from(T t, ConverterContext scope)

Implements org.jooq.ContextConverter.from.

Doc from org.jooq.ContextConverter.from.

Read and convert a database object to a user object.

Parameters
t:T

The database object.

scope:ConverterContext

The context of this conversion.

Returns:U

The user object.

Annotations
@Override
fromTypeback to summary
private static final <T> Class<T> fromType(Class<? extends AttributeConverter<?, T>> klass)
Annotations
@SuppressWarnings:unchecked
toback to summary
public final T to(U u, ConverterContext scope)

Implements org.jooq.ContextConverter.to.

Doc from org.jooq.ContextConverter.to.

Convert and write a user object to a database object.

Parameters
u:U

The user object.

scope:ConverterContext

The context of this conversion.

Returns:T

The database object.

Annotations
@Override
toTypeback to summary
private static final <U> Class<U> toType(Class<? extends AttributeConverter<U, ?>> klass)
Annotations
@SuppressWarnings:unchecked