persistence@glassfish.java.net

Benefit of _at_NamedQuery

From: Markus KARG <markus.karg_at_gmx.net>
Date: Sat, 12 Apr 2008 18:38:14 +0200

Dear Persistence Team,

thank you for providing TopLink Essentials. It is a great product that
improved our productivity by far. :-)

Today I am curious about @NamedQuery implementation in TopLink Essentials.

According to the EJB 3.0 Persistence Spec, using @NamedQuery is
beneficial since (a) the QL syntax can be checked at compile time and
(b) the QL statement can be compiled and prepared at bean instantiation
what should result in higher performance.

Well, in theory this sounds great, by my question is: Is that really
true for TopLink Essentials?

I have done a small benchmark and actually the result was annoying. The
veryfier did not notice that I had a typo in my @NamedQuery syntax so
(a) is not working properly (maybe a bug?) and I did not find any
performance benefits compared to a non-named query created on the fly
from a Java string at runtime, so (b) is not really measurable.

So what is the official statement of the persistence team on this topic?
Was my benchmark done in an unfair way, or is something planned to get
improved here in the future? What kind of prophilactic optimization is
TopLink doing on @NamedQuery and why is the verifier not telling about
my typo?

Thanks a lot! :-)
Markus

-- 
http://www.xing.com/go/invita/58469