Closed estebes closed 5 years ago
Could you give me the column types in the dB and what the destination object type is? Is that just a j.u.Date or one of the Java time?
The column types are timestamptz (PostgreSQL) and the destination types are OffsetDateTime (the records and pojos are generated being generated by JOOQ).
Thanks will have a look asap
Don't now if it helps but the sfm version im using is 6.0.8
when using fetch().intoResultSet() jooq is creating a mock resultset with metadata return has
sqlType : 12 or VARCHAR
getColumnClassName : "OffsetDateTime"
getColumnTypeName : "timestamp with time zone"
the other result set sqlType : 93 or VARCHAR getColumnClassName : "Timestamp" getColumnTypeName : "timestamptz"
which we could use to deal with it
Is it something i can fix in my code or do I have to wait for you to fix it?
yes should be able, when sqlType is 12 I'll double check out the columnclassname. I don't imagine your the same person as https://twitter.com/scott_shid/status/1060887524237864960 ?
sorry meant it really needs to be fixed in the code, I should be able to push it out tonight. is there a reason you prefer using fetch().intoResultSet()?
No I don't have a twitter account. I prefer fetch().intoResultSet() because it handles everything for me. From the JOOQ docs:
Instead of operating on a JDBC ResultSet holding an open resource from your database, you can also let jOOQ's org.jooq.Result wrap itself in a java.sql.ResultSet. The advantage of this is that the so-created ResultSet has no open connection to the database. It is a completely in-memory ResultSet:
I found about this because HikariCP was complaining about connection leaks due to me using the ResultSet without closing it. So I found about this wrapping which would solve the problem entirely but that exception prevents me from using this solution. I am just using the other way and handling the result set closing and what not but it is not as nice or clean.
6.0.9 is now available in maven central with the fix.
Thank you very much.
np, could you just confirm it worked? when you can? Thanks for the report!
Can confirm it is working. If I find any problem during my testing in the next few days I'll let you know. Thanks again.
When using JOOQ and using .fetch().intoResultSet() instead of .fetchResultSet() I get an exception:
java.lang.IllegalStateException: No date format specified at org.simpleflatmapper.converter.impl.time.JavaTimeHelper.getDateTimeFormatters(JavaTimeHelper.java:56) at org.simpleflatmapper.converter.impl.time.AbstractMultiFormatContextualConverterFactory.newConverter(AbstractMultiFormatContextualConverterFactory.java:20) at org.simpleflatmapper.converter.ConverterService.findConverter(ConverterService.java:90) at org.simpleflatmapper.map.fieldmapper.ConstantSourceFieldMapperFactoryImpl.lookForAlternativeGetter(ConstantSourceFieldMapperFactoryImpl.java:272) at org.simpleflatmapper.map.fieldmapper.ConstantSourceFieldMapperFactoryImpl.getGetterFromSource(ConstantSourceFieldMapperFactoryImpl.java:249) at org.simpleflatmapper.map.fieldmapper.ConstantSourceFieldMapperFactoryImpl.newFieldMapper(ConstantSourceFieldMapperFactoryImpl.java:195) at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.newFieldMapper(DefaultConstantSourceMapperBuilder.java:920) at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder$PropertyFieldMeta.targetFieldMapper(DefaultConstantSourceMapperBuilder.java:757) at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.targetFieldMappers(DefaultConstantSourceMapperBuilder.java:649)...
If I use the normal .fetchResultSet() way everything works.