Skip Headers

# Configuring Named Query Selection Criteria

Previous

Next

Use this tab to specify the format of the named query and enter the query string.

Use the following information to complete each field on this tab:

Field | Description
--- | ---
Type | Specify if query uses a TopLink Expression, SQL, or EJB QL.
Expression or Query String | If the Type is SQL or EJB QL, enter the query string (either SQL or EJB QL). TopLink Workbench does not validate the query string. See a note that follows this table for information on query syntax.

Note:

Use a combination of an escape character and a double-quote ( \" ) instead of just a double-quote ( " ) when defining your query using SQL or EJB QL. For example:

    SELECT OBJECT(employee) FROM Employee employee WHERE employee.name = \"Bob\"

If you fail to do so, the generated Java code would look as follows:

    query.setEJBQLString("SELECT OBJECT(employee) FROM Employee employee WHERE employee.name = "Bob"");

The preceding code produces an error at compile time.

If you define your query using the correct syntax, the generated Java code will contain no errors and be similar to the following:

    query.setEJBQLString("SELECT OBJECT(employee) FROM Employee employee WHERE employee.name = \"Bob\"");

See Also

  Configuring Named Queries at the Descriptor Level