openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <>
Subject [jira] Commented: (OPENJPA-511) Unable to execute native queries which start with the WITH keyword.
Date Thu, 07 Feb 2008 15:56:08 GMT


Patrick Linskey commented on OPENJPA-511:

I would suggest putting a List<String> into DBDictionary that contains native SQL start
words, and then putting WITH into the list in the DB2Dictionary constructor, and then change
the logic to delegate to a new DBDictionary method to determine if a string is a SELECT-style
statement or a callable statement.

> Unable to execute native queries which start with the WITH keyword. 
> --------------------------------------------------------------------
>                 Key: OPENJPA-511
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.0.1
>         Environment: DB2
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>             Fix For: 1.1.0
>         Attachments: OPENJPA-511.patch.txt
> Some databases support using WITH ${var} AS (SELECT . . .) SELECT ${var}, . . . The variable
may be used in a future select statement.
> Currently OpenJPA checks whether a native query begins with "select" (case insensitive)
and throws an exception if an application calls getSingleResult() or getResultList() if select
isn't found.  As I understand it the WITH statement may only be used in conjunction with a
SELECT statement, so it should be safe to treat the WITH statement as a select. 
> I'm not sure how many databases support this syntax so it might be best to limit the
support to specific databases. 
> The only database to support the WITH statement that I know of is DB2, but this may apply
to other databases too. Additional documentation can be found in the DB2 infocenter :

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message