I have performance problems with large lists of beans due to the base
class I am using for my entities.
This is slightly non-OpenJPA specific, so I hope nobody minds, but it is
Friday afternoon so I'm hoping you give me a bit of slack here.
The problem arises when I start building lists with over 10,000 items on
a parent class.
The trouble is in the base class for the entities, which is quite clever
(but obviously not clever enough) and it has non-facile equals() and
hashcode() algorithms which make use of reflection. It's here that the
slow-down comes.
When I link the child with a parent that already has 10,000 children,
the equals() method is called by ArrayList before the new child is
placed in the index.
As far as I can tell I have a couple of options.
(1) ditch the reflection-based equals method and hard-code an equals method.
(2) don't use ArrayList but find a Collection-based class that uses
hashes or similar to identify items instead of equals. This is just
speculation - perhaps there is no such thing or it wouldn't help anyway:
- would a collection using hashes caches the hashes of the items
already indexed?
- would such a collection be persistable?
If anyone has been in this situation before, or has an idea about it ,
I'd really appreciate the help.
Regards
Adam