persistence@glassfish.java.net

Re: JPQL: add query name and text to query error messages (issue 1795)

From: Tom Ware <tom.ware_at_oracle.com>
Date: Wed, 20 Dec 2006 09:09:33 -0500

Hi Michael,

The changes look good to me.

Just one comment:

- The change appears to contain quite a few formatting changes in
EJBQLException that appear unrelated to the actual fix. My vote is that
we avoid making these kinds of changes in bug fixes unless there is a
good reason. What to you think?

-Tom

Michael Bouschen wrote:

>Hi Tom, hi Jielin,
>
>attached you find an updated version of my changes to fix 1795
>"Usability improvment: Log details about a NamedQuery when its
>compilation fails". I merged my updates with Jielin's recent changes
>adding line and column information to the query error messages. The
>interesting changes are in EJBQLException/EJBQLExceptionResource and in
>the EJBQLParser. A lot of parse tree node need to be changed just
>because of the updated signature of the method creating the exception.
>
>Thanks!
>
>Regards Michael
>
>
>
>>Hi Tom, hi Jielin,
>>
>>attached you find my changes to fix the enhancement issue 1795
>>"Usability improvment: Log details about a NamedQuery when its
>>compilation fails":
>>https://glassfish.dev.java.net/issues/show_bug.cgi?id=1795.
>>
>>This fix include two parts:
>>- Add a new overloaded method to create a query parser instance to the
>>internal parser API. The new method takes a the name of a named query
>>in addition to the query text. This allows the parser to add the name
>>to an error message. I added the name (if available) as a prefix to
>>the query text included in the beginning of the error message, e.g.
>>"Syntax error parsing the query [findCustomersByCity: SELECT c FROM
>>Customer c c WHERE c.city = :city], unexpected token [c]."
>>- In the current implementation only syntax errors include the query
>>text in the error message. I added the query text to the other error
>>messages, e.g.
>>"Error compiling the query [{0}]. Multiple declaration of
>>identification variable [{1}], previously declared as [{2} {1}]."
>>
>>Jielin,
>>you are currently working on 1355 "Add line and column info to query
>>compiler error messages" which affects the same sources. I will wait
>>until you checked in and then merge my changes.
>>
>>Thanks!
>>
>>Regards Michael
>>
>>
>
>
>

-- 
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com