If jOOQ tries to fetch a huge result set in a stream, but you get ʻOutOfMemoryError`, the fetch size is probably infinite (in the case of PostgreSQL driver). Let's make the XML file of jOOQ used as the default setting value of fetch size of jOOQ directly under the root of the classpath.
(Refer to ʻorg.jooq.conf.SettingsTools` for detailed processing)
src/main/resources/jooq-settings.xml
<?xml version="1.0" ?>
<settings
xmlns="http://www.jooq.org/xsd/jooq-runtime-3.11.2.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--Please specify an appropriate size.-->
<fetchSize>1000</fetchSize>
</settings>
In addition, in order to unmarshall the above XML to JavaBeans according to the above settings, the following dependency is required separately. Let's add it.
build.gradle
//Depending on the case, the version specification may differ, so please search for an appropriate value.
runtime('javax.activation:activation:1.1.1')
runtime("com.sun.xml.bind:jaxb-impl:...")
runtime("com.sun.xml.bind:jaxb-core:...")
Even if you use spring-boot-starter-jooq
in SpringBoot, there seems to be no way to implement the same settings as above in ʻapplication.properties` etc., so let's give up and put the XML file.
I had a colleague teach me.
It seems that the following character string should be added to PostgreSQL JDBC URL.
&defaultRowFetchSize=1000