--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/8ed0184c-f9a9-4ff0-a694-7908a3aabbc3n%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/4tM-YEuqISw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/2329f3ef-ff9e-4737-a220-f6ae6a1f506en%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CACm_Rdg7JNMRqh0gTWSVf4xTngkRF4n6VmGNKKwgKz46YZ%3DSzQ%40mail.gmail.com.
<database>
<name>org.jooq.meta.postgres.PostgresDatabase</name>
<includes>.*</includes>
<inputSchema>public</inputSchema>
<excludes>schema_version</excludes>
<forcedTypes>
<!--implicit conversion for DurationType-->
<forcedType>
<userType>com.spotify.sparta.model.api.DurationType</userType>
<converter>com.spotify.sparta.model.data.DurationTypeConverter</converter>
<includeExpression>(COMMITMENT_)?DURATION_TYPE</includeExpression>
<includeTypes>DURATION_TYPE</includeTypes>
</forcedType>
... /Helenapackage com.spotify.sparta.model.data;
import com.spotify.sparta.db.enums.JDurationType;
import com.spotify.sparta.model.api.DurationType;
import java.util.Locale;
import javax.annotation.Nullable;
import org.jooq.Converter;
/**
* Converts between JDurationType and DurationType.
* <p>
* A JOOQ converter allows for two-way conversion between two Java data
* types T and U. By convention, the T type corresponds to the
* type in your database whereas the U type corresponds to your own user type.</p>
*/
public class DurationTypeConverter implements Converter<JDurationType, DurationType> {
private static final long serialVersionUID = -7984438104416578889L;
@Nullable
@Override
public DurationType from(JDurationType dbObject) {
//this null check is required cause of jooq "null" object preparation before insert
if (dbObject == null) {
return null;
}
return DurationType.valueOf(dbObject.name().toUpperCase(Locale.ENGLISH));
}
@Override
public JDurationType to(DurationType userObject) {
return JDurationType.valueOf(userObject.name().toLowerCase(Locale.ENGLISH));
}
@Override
public Class<JDurationType> fromType() {
return JDurationType.class;
}
@Override
public Class<DurationType> toType() {
return DurationType.class;
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO6OvvPNqEG0mneU2Ca4uuhZQDf0%2BGv%3D4BGZFyjkegY%3DvQ%40mail.gmail.com.
diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java b/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java index 729a9ec..e2ebebf 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/DefaultDataType.java @@ -334,8 +334,8 @@ if (TYPES_BY_TYPE[ordinal].get(type) == null) TYPES_BY_TYPE[ordinal].put(type, this); - if (TYPES_BY_SQL_DATATYPE[ordinal].get(this.sqlDataType) == null) - TYPES_BY_SQL_DATATYPE[ordinal].put(this.sqlDataType, this); + if (TYPES_BY_SQL_DATATYPE[ordinal].get(sqlDataType) == null) + TYPES_BY_SQL_DATATYPE[ordinal].put(sqlDataType, this); // Global data types if (dialect == null)
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CACm_Rdgt73cnPLxKbSH0HaHc66ktFOsqxbfLdKv0GvTVFKr%2B0A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO781O7EU8FEQ7rFimtjLSPBkfyHky-5-WgAN0%2BDR9BuLw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CACm_Rdgjk-xeh82%2Bvf7wC0myQs%2B%2BntbWqZPwvG%3DSr%3D7jD986TA%40mail.gmail.com.