-
1. Re: Validation of HQL query in the Java code / xml file
maxandersen May 30, 2006 9:23 AM (in response to epbernard)we could do this yes.
Just run the query through the QueryTranslator and mark a query as bad if it does not accept it.
Put it in jira (my biggest concern though is scalability of it...for e.g. huge projects) -
2. Re: Validation of HQL query in the Java code / xml file
epbernard May 30, 2006 11:46 AM (in response to epbernard)Eclipse calculates the warning when you actually see the java code, doesn't it?
My main concern is the ability to "reckognize" an HQL query in the code. (probably find the query used when createQuery is called). -
3. Re: Validation of HQL query in the Java code / xml file
epbernard May 30, 2006 11:51 AM (in response to epbernard)My point is to actually have a "compile-time like checking" PowerBuilder like feature reinvented by LINQ
-
4. Re: Validation of HQL query in the Java code / xml file
maxandersen May 30, 2006 11:56 AM (in response to epbernard)huh ?
-
5. Re: Validation of HQL query in the Java code / xml file
maxandersen May 30, 2006 2:06 PM (in response to epbernard)well i would target @NamedQuery first.
createQuery is triggy, but I guess we can assume if you have just a string in there it will be safe to validate it.
e.g.
q.createQuery("from Product p where p.x=?") would be checked but
I would skip
q.createQuery("from Producer p where " + someextra);
but named query annotations is doable first since they are much easier more efficient to locate. -
6. Re: Validation of HQL query in the Java code / xml file
epbernard May 30, 2006 3:17 PM (in response to epbernard)So
1. target @NamedQuery(ies) and hbm/ ejb3 DD
2. target simple strings (createQuery("...") or createQuery(CONSTANTS)
3. do some magic-ish things for more complex strings :-)
1 is cool
2 is fantastic
3 is a + but not that critical frankly