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 216643 - JPA Autocomplete fails when NamedQuery name is not a literal
Summary: JPA Autocomplete fails when NamedQuery name is not a literal
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords: USABILITY
Depends on:
Blocks:
 
Reported: 2012-08-10 08:10 UTC by atr_23
Modified: 2012-09-20 02:25 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description atr_23 2012-08-10 08:10:32 UTC
It would be nice if all of the following variants would be supported. Allowing expressions in the query would be great too. Also see http://netbeans.org/bugzilla/show_bug.cgi?id=212951

@NamedQueries({
    //jpql completion
    @NamedQuery(name = "MyEntity.findByName0", query = "SELECT me FROM MyEntity me WHERE me.name=:name"),
    //no jpql completion
    @NamedQuery(name = MyEntity.ENTITY_NAME + ".findByName1", query = "SELECT me FROM MyEntity me WHERE me.name=:name"),
    @NamedQuery(name = MyEntity.QUERY, query = "SELECT me FROM MyEntity me WHERE me.name=:name")
})
@Entity(name = MyEntity.ENTITY_NAME)
public class MyEntity implements Serializable {

    public static final String ENTITY_NAME = "MyEntity";
    /**
     * Parameters: name ({@link String})
     */
    public static final String QUERY = ENTITY_NAME + ".findByName2";
Comment 1 Sergey Petrov 2012-08-10 10:36:05 UTC
autocompletion may be easy to enable, but need to check also navigation to queries with names build from literals, may be it will not work and may not be supported first.
Comment 2 Sergey Petrov 2012-09-18 11:50:45 UTC
have small fшx to cover simple identifier, but ше will not work for complex(summ etc.) case
Comment 3 Quality Engineering 2012-09-19 03:03:56 UTC
Integrated into 'main-golden', will be available in build *201209190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8588898f93ec
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: #216643 fix parser
Comment 4 Sergey Petrov 2012-09-19 12:07:17 UTC
http://hg.netbeans.org/web-main/rev/268befa2f555 should be fixed for mentioned case, but there are some other issues I'm going to fix as separate case
Comment 5 Quality Engineering 2012-09-20 02:25:51 UTC
Integrated into 'main-golden', will be available in build *201209200001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/268befa2f555
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: #216643 enhance logic to support more combinations in attribute value