I do not understand what type of code you expect to get and what stack
trace you are talking about. A named query is as simple as putting
"@NamedQuery(name = "MyQuery", query = "SELECT c FROM Car c")" in the
code of @Entity Car, and to call the query with
"this.entityManager.createNamedQuery("MyQuery").getResultList();" in the
client (e. g. session bean).
What the spec pretends of doing so is:
(a) The verifier can check the syntax of the QL at deploy time. I
checked it with a typo in the QL. GlassFish's verifier told me that
there are 0 warnings, 0 errors, 0 infos.
(b) The query runs faster sind it can be precompiled at deploy time. I
measured it and did not find measurable performance benefits compared to
non-named quers created "inline" with
"this.entityManager.createQuery("SELECT c FROM Car c").getResultList();".
What actually did you not understand regarding my question?
Thanks
Markus
Eve Pokua schrieb:
> Markus,
>
> I think you might want to send the persistence team a little more coding
> for them to figure out what you are really talking about and for the
> benefit
> of learners like me. code you also send the stack trace of deployment?
>
> eve
>
>
>
>
> ------------------------------------------------------------------------
>
> > Date: Sat, 12 Apr 2008 18:38:14 +0200
> > From: markus.karg_at_gmx.net
> > To: persistence_at_glassfish.dev.java.net
> > Subject: Benefit of @NamedQuery
> >
> > 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
> >
>
>
> ------------------------------------------------------------------------
> A prize an hour, 24 hours a day. Try Big Snap now!
> <http://www.bigsnapsearch.com%0A%20>
--
http://www.xing.com/go/invita/58469