You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Sy...@swisscom.com on 2003/05/21 12:54:06 UTC

Java.lang.OutOfMemoryError problem

Hello,

This code below returns a Java.lang.OutOfMemoryError during the execution of the getCollectionByQuery method.
The table Workstation contains 23'000 entries. It has about 20 fields, 5 references and 3 collections. Each collection or reference have a proxy.
The problem doesn't occur when I add a criteria and have less than 5'000 or 10'000 entries.

Is someone has an idea what could be the reason?

----code----
Query query = new QueryByCriteria(Workstation.class, null);

try {
  broker.beginTransaction();
  Collection allEntries = broker.getCollectionByQuery(query);
  broker.commitTransaction();
} catch (Throwable t) {
  broker.abortTransaction();
  t.printStackTrace();
}
----code----


Thanks
Sylvain

Re: Java.lang.OutOfMemoryError problem

Posted by Thomas Mahler <th...@web.de>.
Hi Sylvain,

If you perform a null criteria query you select all rows from the 
underlying table(s).
specifying proxies does not reduce the number of Workstation instances 
in memory, but only the number of materialized reference and collection 
instances.

So I see no other way than increasing the Java heap size.

cheers,
Thomas

Sylvain.Thevoz@swisscom.com wrote:
> Hello,
> 
> This code below returns a Java.lang.OutOfMemoryError during the execution of the getCollectionByQuery method.
> The table Workstation contains 23'000 entries. It has about 20 fields, 5 references and 3 collections. Each collection or reference have a proxy.
> The problem doesn't occur when I add a criteria and have less than 5'000 or 10'000 entries.
> 
> Is someone has an idea what could be the reason?
> 
> ----code----
> Query query = new QueryByCriteria(Workstation.class, null);
> 
> try {
>   broker.beginTransaction();
>   Collection allEntries = broker.getCollectionByQuery(query);
>   broker.commitTransaction();
> } catch (Throwable t) {
>   broker.abortTransaction();
>   t.printStackTrace();
> }
> ----code----
> 
> 
> Thanks
> Sylvain
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>