# JPQL Query Editor

Use to write and execute JPQL queries within the IDE and view the results of the query. The query editor supports code completion for JPQL keywords and for managed entities in your application.

You open the JPQL Query Editor by right-clicking the `persistence.xml` file in the Projects window or Files window and then choosing Run JPQL Query in the popup menu. The Persistence Unit drop-down list in the toolbar of the JPQL Query Editor contains the persistence units that are specified in `persistence.xml`. To run a query, type the query in the text area of the query editor, select a persistence unit in the drop-down list and click the Run JPQL Query button in the toolbar ( Run JPQL ).

When you run a JPQL query, the query is run against the database that is specified in the persistence unit that is selected in the drop-down list. The results of the query appear in the Result pane in the lower half of the JPQL Query Editor.

Note: You need to build the project before you can run the JPQL query.

The drivers for the database that is specified in the persistence unit must be on the project classpath.

If you are using EclipseLink as the persistence provider you can click the SQL tab to view the SQL query that corresponds to the JPQL query.

Related Topics

Developing Applications with NetBeans IDE,

Copyright © 2016, Oracle and/or its affiliates. All rights reserved.