Hans-
My first guess is that Toplink might be eagerly loading the relation,
and OpenJPA is lazily loading it (i.e., it doesn't load the relation
when you issue the query, so every time you call person.getAccount(),
OpenJPA has to go back to the database). To verify this, you could
enable SQL logging (see the docs for details) and observe the SQL
that OpenJPA is executing.
Configuring eager fetching is a broad topic and is covered in detail
in the documentation, but the quickest way to speed up the query
might just be to add in a "join fetch" clause to the query. E.g., if
your current query is "select p from Person p", then changing the
query to be "select p from Person p join fetch account" might be
sufficient to speed up the query.
Let us know if that doesn't work, and we can discuss more diagnostic
and tuning steps you can take. I'm confident that OpenJPA's
performance is at least be comparable to other implementations, and
in many cases is significantly faster.
On Mar 14, 2007, at 11:18 AM, Hans J. Prueller wrote:
Hi together,
please allow me a simple question: I am currently preparing a "JPA"
workshop
for a customer to show the developers
the new way of working with JPA persistence in Java EE 5. Just to
show one
of the advantages of an open standard like JPA
I prepared the example to switch between OpenJPA and TopLink
Essentials "on
the fly" just by changing the "provider"
setting in persistence.xml and keeping the sourcecode unchanged.
Basically this works fine but what I found out was that when
querying for
objects with one-to-many relation and accessing
the Collection (e.g. person.getAccount()), TopLink is about ten
times faster
then OpenJPA. Oracle 9 Database is used as
DB.
Did I miss any tuning parameters or something that could enhance
OpenJPA
performance? I just can't imagine that there
are performance differences for simple "tutorial" application in
that order
of magnitude!
regards,
HANS
===========================
virtually hanzz...
<http://hanzz.zapto.org> http://hanzz.zapto.org (personal)
<http://www.cse.dmu.ac.uk/~hansp> http://www.cse.dmu.ac.uk/~hansp
(research)