| I analyzed this a bit and found out that this can be reduced to the following. Entity A has a one-to-one to Entity B which map the inverse one-to-one back to Entity A. When querying Entity A and fetching Entity B, there will be another query fired for Entity A, even if the query also fetch joins Entity A of Entity B. The reason is not quite clear to me, but the symptom is that the loader tries to load Entity A(the inverse one) while initializing Entity A(the one that is queried). So it seems like the cycle isn't handled well. There is no entry of Entity A in the persistence context yet, though it could be. Maybe it's enough to put the object into the persistence context earlier, but then there was also a mention on some of the related issues about introducing another map in the persistence context to catpure these objects. I'm not sure what the best implementation for this might be, but it definitely is a big performance problem. |