This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 246712 - [801cat] Regression: Code completion for beans stopped working on FCS build
Summary: [801cat] Regression: Code completion for beans stopped working on FCS build
Status: RESOLVED INCOMPLETE
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 8.0.1
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Assignee: Sergey Petrov
URL:
Keywords: RANDOM
Depends on:
Blocks:
 
Reported: 2014-08-27 00:07 UTC by ecerichter
Modified: 2014-09-19 17:33 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Messages.log from the session that had the problem (72.33 KB, application/octet-stream)
2014-08-27 00:39 UTC, ecerichter
Details
Screen capture illustrating "confused" code completion/warnings. (92.29 KB, image/png)
2014-08-27 01:22 UTC, carljmosca
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ecerichter 2014-08-27 00:07:34 UTC
When building a JPA query (code, not annotations), beans attributes and beans names are not being offered.

Piece of code:

static List<Product> getProducts(String code) {
    EntityManager em = null;

    try {
      em = BrokerUtil.getEntityManager();
      TypedQuery<Product> qry = em.createQuery("select distinct O from Product O where O.|", Product.class);
    } finally {
      BrokerUtil.closeEntityManager(em);
    }

then at cursor position "|" I do type Ctrl+Space and nothing happens.
In NetBeans 8.0 it works as expected, provinding options regarding Product object.

Regards,

Edson
Comment 1 ecerichter 2014-08-27 00:36:06 UTC
I've downgraded to 8.0 for testing purposes.
It worked fine.
After, I've return to 8.0.1, and now it is working again.
I'll lower the prio to P2, but Carl Mosca (in NetCat list) have been able to reproduce the problem, would worth to ask if a NetBeans reboot would bring code completion back to work.
Comment 2 carljmosca 2014-08-27 00:38:17 UTC
I am willing to try again.  Did you restart NetBeans only or a complete wipe/reinstall?  I believe I did the former.
Comment 3 ecerichter 2014-08-27 00:39:15 UTC
Created attachment 148913 [details]
Messages.log from the session that had the problem
Comment 4 carljmosca 2014-08-27 01:22:41 UTC
Created attachment 148914 [details]
Screen capture illustrating "confused" code completion/warnings.
Comment 5 ecerichter 2014-08-27 01:31:16 UTC
(In reply to carljmosca from comment #2)
> I am willing to try again.  Did you restart NetBeans only or a complete
> wipe/reinstall?  I believe I did the former.

Actually, I wanted to test in previous release (8.0), which I still have installed.

My installation is

/opt/netbeans-8.0 : my old installation
/opt/netbeans-8.0.1 : my new installation

I run everything from /opt/netbeans, so what I did was

sudo mv /opt/netbeans-8.0 /opt/netbeans

Then I've run the tests. After, I've closed NetBeans and moved the 8.0.1 back:

sudo mv /opt/netbeans /opt/netbeans-8.0
sudo mv /opt/netbeans-8.0.1 /opt/netbeans

Started NetBeans, and after traditional 'background scanning', everything went back to life.

I'm sure there is something there, but I can't tell for sure how to reproduce.
Good to see you have been able to upload a screen capture.
Comment 6 ecerichter 2014-08-27 01:36:59 UTC
I think in your screen capture there is something a bit confusing.
If you have a class

class Customer {
  private String name;

  public String getName() { return name; }
  public void setName(String n) { this.name = n; }
}

then you JPA query must be something like

TypedQuery<Customer> qry = em.createQuery("select O.name from Customer O where O.name = 'Carl'", Customer.class);

Otherwise, it will report wrong syntax.

Please, double check if after type O.|  the bean attributes are offered. My issue is because those attributes are not being offered as option.
Comment 7 carljmosca 2014-08-27 01:44:01 UTC
Yes, it's been a long day.  :)

You are correct but that does not correct the problem for me.  (I had tried "correct" syntax in my earlier testing.)

Code completion/warnings seem to come and go.

I thought it may be having trouble connection to the database because at one point I got some sort of "resolving" message (I did not capture it).
Comment 8 ecerichter 2014-08-27 01:50:23 UTC
(In reply to carljmosca from comment #7)
> Yes, it's been a long day.  :)
> 
> You are correct but that does not correct the problem for me.  (I had tried
> "correct" syntax in my earlier testing.)
> 
> Code completion/warnings seem to come and go.
> 
> I thought it may be having trouble connection to the database because at one
> point I got some sort of "resolving" message (I did not capture it).

I don't think that a database connection is required: JPA is about querying objects, and the database connection is necessary only at runtime.

But I agree: the problem come and go without clear explanation why. I could not see anything relevante in logs.

May be someone at Oracle is able to reproduce the problem and discover the cause. I know that 8.0.1 had some improvements in code completion/indexing, and I do believe that there is something related - but I can't prove anything so far.

Thanks for your help on working in this issue.

Regards,

Edson
Comment 9 carljmosca 2014-08-27 01:52:42 UTC
Happy to...thank you for reporting it.

Code completion is something I generally take advantage of in NetBeans whenever possible. :)

Take care,
Carl
Comment 10 carljmosca 2014-08-27 02:00:24 UTC
One more (possibly unrelated) issue...back to my original use case, the annotations.

@NamedQuery seems to work well but @NamedNativeQuery does not seem to at all currently.  Is this by design?

I am asking because native queries seem to have very nice code completion in the NB SQL editor.
Comment 11 Sergey Petrov 2014-08-27 07:48:24 UTC
There should be no difference in complettion in 
.createQuery(" and query="
the only possible difference is parsing/index ready may be cache problems with 8-8.0.1 upgrade?
Comment 12 Sergey Petrov 2014-08-27 07:49:38 UTC
shotscreen seems to show valid warning
Comment 13 Sergey Petrov 2014-08-27 08:03:01 UTC
Jpa features are heavily dependent on index/parsing/cache, if it's by occasion became corrupted there are two problems
- it's hard to find out when exactly it became corrupted and why to file corresponding issue and argue proper evaluation, I suppose it's really hard to get details for evaluation in this case.
- because of above it's hard to evaluate in persistence area

If you can't reproduce yourself, it's really hard to proceed with the issue.

I may need to try fcs also, but in 20140731 I can't reproduce  and there was no changes in jpa after this build and no much changes elsewhere
Comment 14 Sergey Petrov 2014-09-19 12:11:22 UTC
finally I can't reproduce with 8.0.1, I can cc at supposed place without any problem. unfortunately it's hard to continue evaluation as nobody can reproduce the issue now it's hard to estimate what nb area is reproducible in this case also. in my opinion something should happens in scanning phase.
Comment 15 ecerichter 2014-09-19 17:33:30 UTC
You are completely right.

I can't provide a "steps to follow" on this. Perhaps, I could not reproduce the error anymore after downloading the final (production) version.

Thanks and sorry for the false alarm.

Regards,

Edson Richter