Hi Christopher, Take a look at the openjpa.ConnectionRetainMode property [1] [2].
[1] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#openjpa.ConnectionRetainMode [2] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_dbsetup_retain It sounds like you'd benefit from setting it to 'always' or 'transaction'. Regards -mike On Tue, Sep 29, 2009 at 8:08 AM, Christopher Giblin <[email protected]>wrote: > > Hi, > Is there any way to influence OpenJPA's connection usage when not using > connection pooling? > > I plan to move to connection pooling in the future but cannot quite at the > moment. My OpenJPA is configured to use Derby ClientDataSource. When > iterating over objects with lazy-loaded attributes, the query is naturally > issued to fill the proxy as each object is accessed. However, I never get > through the whole array because eventually the OS has too many TCP > connections (> 2000) closing (in state TIME_WAIT) and can no load open any > more connections. It seems each access opens and closes an DB connection > and hence a TCP connection. I get partially around this by changing queries > and using eager loading. But I cannot do this in all cases. > > I am wondering, is it possible to get OpenJPA to reuse a connection, rather > than opening and closing so frequently? > > Thanks,chris > >
