Bug 217398 - Option to disable JPQL Parsing in NamedQueries(jpa hints enable/disable option)
Option to disable JPQL Parsing in NamedQueries(jpa hints enable/disable option)
Status: RESOLVED FIXED
Product: javaee
Classification: Unclassified
Component: Persistence
7.3
All All
: P2 with 1 vote (vote)
: 8.0
Assigned To: Sergey Petrov
issues@javaee
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-25 09:41 UTC by bht
Modified: 2013-11-19 13:26 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2012-08-25 09:41:00 UTC
JPQL code in Java files is quoted as string attributes within NamedQuery annotations.

This limits useful formatting of larger statements. A common workaround is to concatenate as follows:

@NamedQuery(name= CustomerOrder.GET_ALL, query=
"select\n" +
        "object(c)\n" +
"from CustomerOrder c\n"
    )
	
Apparently JPQL parsing and code completion does not work here.

Support of this might come in the future, but it will be at a cost (bugs, CPU load) that some users are not necessarily happy to pay. In other words, it is possible that multiple disadvantages outweigh potential or non-existing benefits depending on the use case.

Therefore it would be useful to disable JPQL parsing in the Tools Options dialog,
or with a configuration parameter.
Comment 1 Sergey Petrov 2012-08-25 18:44:01 UTC
In usual, cost of this feature shouldn't be big, smilar may be said to be able to configure a lot of different features.
Code completion may not work here because of issue 216643, and may be fixed in 7.3.
jpql parsing should work, but I may recheck.
It's still nice to try latest daily to see if reduce in "time consuming calls" really help. Without 216827 and 216053 this issue isn't valid P2 and even may ot be a defect.
Comment 2 Sergey Petrov 2012-08-25 18:52:38 UTC
Its not also clear if it's extremely rare or more common issue, as even with second reporter (with 4Gb memory usage at first) do not have performance hit(at least after all fixes). As an option it can be temporary implemented in a way similar to issue 215725 (with private project property, without special ui) but still much better to find root cause of slowness.
Comment 3 bht 2012-08-25 19:21:59 UTC
Sure, it was my mistake to make it a defect not an enhancement. A property would be nice. I would like a system wide property, but project specific would be good, too.

That would help in any future cases where JPQL parsing issues must be analysed.
Comment 4 Sergey Petrov 2012-09-03 09:30:28 UTC
I may need to look at a way to configure hints, some java hints support configure and possibility to be disabled in Editor|Hints. It may be good to implement this approach for jpa hints including jpql validation.
Comment 5 bht 2012-11-11 03:55:58 UTC
While performance of the GUI wrt cursor movement etc. as addressed in bug 216827 has improved, the CPU load remains, and on slow systems it is very taxing.

Please refer to bug 221421. Now it is 50 seconds of 100% CPU after saving an entity class with a one line change. This prevents "Run focused test method" execution for 50 seconds.

It is this CPU load, apparently caused by the slow NT file system in Windows XP, which is hopefully reduced by turning off JPQL scanning and hints.
Comment 6 Sergey Petrov 2012-11-11 09:24:11 UTC
why do you think it's related? it still good to add support to disable this validation but I found it requires some redsign to new api and may take longer I expect initially.
Comment 7 bht 2012-11-11 17:26:40 UTC
Sorry I don't feel so strong that this is very related. Perhaps to some extent. I am guessing that an additional layer of scanning if that exists adds CPU load and perhaps I/O which is expensive so if we could turn this off that would be good. CPU starvation is my oncern and that is what I am seeing in bug 221421.
Comment 8 Sergey Petrov 2013-03-13 04:58:05 UTC
subj updated to reflect what need to be done.
Comment 9 Sergey Petrov 2013-07-01 09:50:26 UTC
#231332 may help to find out what need to be done to update jpa hints to new api
Comment 10 Sergey Petrov 2013-09-19 17:03:01 UTC
just recheck initial comment, multi line jpql verification was possible before and will be possible after, cc wasn't possible in case of split jpql and isn't possible yet.
there was also jpql validation even in case if it's hidden in some constants, unfortunately it will be mossed after migration but it may be ok, 
literals and summ of literals will be supported anyway and enable/disable will work as for any other hints.
Comment 11 Sergey Petrov 2013-09-26 13:20:43 UTC
mark as fixed, jpql can be disabled, also most others jpa hints can be disabled also (but not all).


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo