openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <>
Subject RE: empty collections
Date Fri, 15 Jan 2010 14:22:08 GMT
I had some similar issues when loading a large number of data records that
included some joins, I found that if I called the clear function on he
EntityManager every x records it resolved my issue, also solved my OOM
issues also.  



-----Original Message-----
From: Christopher Giblin [] 
Sent: Saturday, 16 January 2010 12:38 AM
Subject: Re: empty collections

Solved. Problem was that both sides of the bi-directional relationship were
not being assigned before persisting, just one side :


The following fixed the problem:


Interesting that by restarting the app, the relationships could be read,
just not after persisting.

Thanks, chris

> Hi,
> I have a bidirectional many-to-many relationship between two
> entities. Each entity references a collection of the other entity.
> I import data, then retrieve entities with a query. However, when I
> refer to an entity's collection, its size is always  0 (eg,
> group.getUsers().size() is  0).  I look into the db and the join
> table is filled correctly. I restart the app, and then the same
> entity correctly returns the collection. That is, group.getUsers
> ().size() is now > 0 and I can access the collection's elements.
> I am wondering is this is a known pattern and there is an a-ha out
> there. Otherwise OpenJPA is working great!
> Thanks,
> chris

View raw message