David,
I don't think the "object AS o" syntax is required since some of my finders
work without it. That was my initial thought too, coming from an SQL
background, but it doesn't seem to make any difference.
If I understand things correctly a finder is used to find a particular
object which means that the EJB-QL will be used in order to retrieve the
primary key of the object. After this is done and you try to access
particular fields, another query must be done to retrieve the fields, but
this time using the primary key to locate the appropriate fields. With
preloading the container can turn a finder query into very poor SQL.
For example:
SELECT pk
FROM product AS p
WHERE p.name LIKE 'whatever%';
Followed by something stupid like...
SELECT name, gtin, description
FROM product AS p
WHERE p.pk = 30 OR p.pk = 28 OR p.pk = 32 OR p.pk = 33 OR ...
(depending on how many search results are found)
Using a select method you can directly retrieve individual fields so the
above query would be directly transformed into the SQL:
SELECT name, gtin, description
FROM product AS p
WHERE p.name LIKE 'whatever%';
Which is much more efficient.
Patrick
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Harkness,
David
Sent: Wednesday, January 14, 2004 5:22 PM
To: [EMAIL PROTECTED]
Subject: RE: [Xdoclet-user] @ejb.select problems with JBoss
On Tue, 2004-01-13 at 20:21, Patrick Bakker wrote:
> I?ve been trying to get the following select method code to work in
> an EJB I call Product:
>
> /**
> * @ejb.select
> * signature="java.util.Collection
> ejbSelectNameMatch(String nameMatch)"
> * query="SELECT OBJECT(p) FROM Product p WHERE p.name LIKE
?1"
I've only done enough EJB-QL to get my basic finders working, and maybe
the syntax is partially fluid, but all of my queries use "<bean> AS
<alias>", e.g. "Product AS p". Is this the problem, and by the time it
gets to the "?1" it's simply too confused to report the error correctly?
Out of curiousity since I haven't used ejbSelect methods yet, why would
you not just make that a finder? Don't you need a Product bean instance
before you can execute a select method? Or am I misunderstanding select
methods?
David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user