Our application is suffering several intermittent hibernate exceptions, mainly these:
- Collection processed twice by flush
- Found shared references to a collection
- Flush during cascade is dangerous
It happens only if you are working with a slow server and you load a lot of entities to the memory.
To make thing worse, problem is not easy to reproduce. Sometimes the system can survive 30 selenium tests, sometimes it fails just after a few requests.
It always happens on flush (usually invoked by JPA query). We use Jboss 4.2.2, Seam 2.1.1 with Extended Persistence and EJB3.
One of the main suspects is a circular reference in entities schema. Studying hibernate code shows that these exceptions are thrown mainly when a collection is processed twice.
Could you please have a look on the part of class schema and make a judgement: can it be a reason for having intermittent hibernate exceptions?
All relations are unidirectional OneToMany or ManyToOne.
The typical example of stacktrace can be:
Caused by: org.hibernate.HibernateException: Found shared references to a collection: D.Es
It also happens for C.Fs and many others.
Another suspect is any timing or multi-threading issue.
Can anybody put some light on it? Is there any technique of solving such a problem?
Thanks in advance,