Hello, It seems that setting openjpa.FetchBatchSize implicitly enables large result set support which is not suitable for your case.
However, chances are you can execute Statement.setFetchSize(int) by extending the DBDictionary you are using, although it needs some typing. As a guidance, see PostgresDictionary.decorate method. It creates a wrapped Connection, which in turn provides wrapped PreparedStatements where you can override methods like executeQuery and inject a call to setFetchSize. Or do it in prepareStatement method of your wrapped Connection. Let us know how it goes. Cheers, Milosz > How do I set fetch size in JPA? I would like the cursor to read 2000 rows at > once to speed up entity generation. Thanks for help! > > -- > View this message in context: > http://openjpa.208410.n2.nabble.com/Using-FetchPlan-setFetchBatchSize-feature-leads-to-java-io-NotSerializableException-tp6771824p6782493.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >