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 226450 - Parsing of named queries doesn't work for enums
Summary: Parsing of named queries doesn't work for enums
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal with 2 votes (vote)
Assignee: Sergey Petrov
Depends on:
Reported: 2013-02-21 10:38 UTC by mienamoo
Modified: 2013-03-22 07:09 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description mienamoo 2013-02-21 10:38:43 UTC
NetBeans build 201302132200
JDK 7u13 64-bit

The IDE is not able to resolved enums when used in named queries, and will display a warning on the entity even though it works perfectly when the query is executed.
Comment 1 Sergey Petrov 2013-02-21 10:41:32 UTC
Can you provide sample query?
Comment 2 cdelahunt 2013-02-21 10:58:26 UTC

Please see an example of the problem below.

We have a class Customer which has a named query that uses the CustomerStatus
enum in the where clause to filter on customer statuses.

package com.hello.customer;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.NamedQuery;

@NamedQuery(name = "Customer.findByStatus", query = "SELECT c FROM Customer c
WHERE c.customerStatus = com.hello.customer.CustomerStatus.ACTIVE")
public class Customer implements Serializable {

    private int id;
    private String name;
    private CustomerStatus customerStatus;

package com.hello.customer;

public enum CustomerStatus {

Netbeans show the following warning for the named query

Customer.findByStatus[50;90]: The state field path
'com.hello.customer.CustomerStatus.ACTIVE' cannot be resolved to a valid type.

Customer.findByStatus[50;53]: The identification variable 'com' is not defined
in the FROM clause.

Hope this helps.
Comment 3 Sergey Petrov 2013-03-19 18:03:21 UTC
thanks, seems to be resolved in latest builds. at least I can't reproduce with suggested sample.
Comment 4 mienamoo 2013-03-22 07:09:53 UTC
Verified with build 201303212300.