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.
Summary: | Parsing of named queries doesn't work for enums | ||
---|---|---|---|
Product: | javaee | Reporter: | mienamoo |
Component: | Persistence | Assignee: | Sergey Petrov <sj-nb> |
Status: | VERIFIED WORKSFORME | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 7.3 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
mienamoo
2013-02-21 10:38:43 UTC
Can you provide sample query? Hi, 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. Customer.java package com.hello.customer; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.NamedQuery; @Entity @NamedQuery(name = "Customer.findByStatus", query = "SELECT c FROM Customer c WHERE c.customerStatus = com.hello.customer.CustomerStatus.ACTIVE") public class Customer implements Serializable { @Id private int id; private String name; @Enumerated(EnumType.STRING) private CustomerStatus customerStatus; } CustomerStatus.java package com.hello.customer; public enum CustomerStatus { INAVCTIVE, ACTIVE } Netbeans show the following warning for the named query "Customer.findByStatus": 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. thanks, seems to be resolved in latest builds. at least I can't reproduce with suggested sample. Verified with build 201303212300. |