Hi Lukas,

Thanks for your reply; that does the trick

Regards,
Mark

On Friday, September 23, 2016 at 1:00:45 PM UTC+2, Lukas Eder wrote:
>
> Hi Mark,
>
> The jOOQ Code generator doesn't "find" your class. It simply takes your 
> string and takes it for "granted". I.e. it's all string based.
>
> Now, when you compile your code, that's a different story. It must be on 
> your compiler's class path. So, your code generation module (same for 
> Maven, Gradle) must have a dependency on a utility module where you put 
> your converters.
>
> I hope this helps,
> Lukas
>
> 2016-09-23 12:15 GMT+02:00 <[email protected] <javascript:>>:
>
>> I use a custom type to convert PostgreSQL DATE types to 
>> java.time.LocalDate as described in the user manual.
>> I use gradle to generate my stuff like this:
>>
>> database {
>>   excludes = 'schema_version'
>>   inputSchema = 'public'
>>   customTypes {
>>     customType {
>>       name = 'LocalDate'
>>       type = 'java.time.LocalDate'
>>       converter = 'com.example.helpers.LocalDateConverter'
>>     }
>>   }
>>   forcedTypes {
>>     forcedType {
>>       name = 'LocalDate'
>>       expression = '.*'
>>       types = 'DATE'
>>     }
>>   }
>> }
>> generate {
>>   deprecated = false
>>   pojos = true
>>   daos = true
>>   jpaAnnotations = true
>>   springAnnotations = true
>> }
>>
>> The LocalDateConverter is this:
>>
>> public class LocalDateConverter implements Converter<Date, LocalDate> {
>>
>>
>>     @Override
>>     public LocalDate from(Date databaseObject) {
>>         return null == databaseObject ? null : databaseObject.toLocalDate
>> ();
>>     }
>>
>>
>>     @Override
>>     public Date to(LocalDate userObject) {
>>         return null == userObject ? null : Date.valueOf(userObject);
>>     }
>>
>>
>>     @Override
>>     public Class<Date> fromType() {
>>         return Date.class;
>>     }
>>
>>
>>     @Override
>>     public Class<LocalDate> toType() {
>>         return LocalDate.class;
>>     }
>> }
>>
>> My generated stuff correctly uses the LocalDate type instead of 
>> java.sql.Date.
>> But when compiling I get an error saying the import to the converter 
>> class can't be found while this is on my classpath in src/main/java. It is 
>> used during generation so it CAN be found.
>> Why can't it be found during compilation of the app??
>> I am using Gradle 3.1 and jOOQ 3.8.4
>>
>> Regards,
>> Mark
>>
>> -- 
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to