Problem with select performance

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Problem with select performance

Hello all!

I have a performance problem getting data from the database. I have a modeltree with some oneToMany relations (see attached image). If I try to read only a specific amount of records with the Query#setMaxResults function, the created sql statements seems the problem.

The first is is correct:
    FROM test_head t0 ORDER BY DESC LIMIT ?

But the following statements, which read the relations, run without any restrictions:
SELECT,, t1.head_id, t1.text
    FROM test_head t0 INNER JOIN test_lines t1 ON = t1.head_id ORDER BY ASC,

This select produces two full tablescans on the database.

I added a exampleproject as an attachment.

Made I something wrong or is the a bug in openjpa?

Best regards,

PS: I hope you can understand my poor english. (10K) Download Attachment