openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MiƂosz Tylenda <mtyle...@o2.pl>
Subject Re: Using FetchPlan.setFetchBatchSize() feature leads tojava.io.NotSerializableException
Date Mon, 12 Sep 2011 18:32:35 GMT
Hi again,

Some database drivers might allow you to specify the default fetch size in connection URL
or data source definition. For example, Oracle docs say they have a "defaultRowPrefetch" property
for this. Of course, this is not specific to OpenJPA / JPA.

Greetings,
Milosz


> 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.
> > 
> 

Mime
View raw message