You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Art Allisany (JIRA)" <ji...@apache.org> on 2009/08/14 15:39:14 UTC

[jira] Commented: (DERBY-4338) Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments

    [ https://issues.apache.org/jira/browse/DERBY-4338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12743199#action_12743199 ] 

Art Allisany commented on DERBY-4338:
-------------------------------------

This error prevents hibernate comments from being prepended to the sql query which is a very useful feature to correlate jpa queries with sql queries.

in jpa persistence.xml

<property name="hibernate.use_sql_comments" value="true"/>

Hibernate: /* SELECT e FROM CommonEntity e JOIN e.addresses a WHERE a.countryCode = 'us' */ select commonenti0_.id as id0_, commonenti0_.billingAddress as billingA3_0_, commonenti0_.shippingAddress as shipping4_0_, commonenti0_.purchaser_id as purchaser6_0_, commonenti0_.businessId as businessId0_, commonenti0_.DTYPE as DTYPE0_ from CommonEntity commonenti0_ inner join CommonEntity_Address addresses1_ on commonenti0_.id=addresses1_.CommonEntity_id inner join Address address2_ on addresses1_.addresses_id=address2_.id where address2_.countryCode='us'

WARNING: SQL Error: 20000, SQLState: XJ207
SEVERE: executeQuery method can not be used for update.

If I remove the hibernate.use_sql_comments the select query succeeds, so I have confirmed Will's bug on Apache Derby Network Server - 10.5.1.1.

> Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4338
>                 URL: https://issues.apache.org/jira/browse/DERBY-4338
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.4.2.0
>            Reporter: Will Gomes
>
> Network derby client does not properly detect a sql select statement preceded by /* */ comments.  As a result the sql appears to be detected as an update statement, and results in  the following error:
>  org.apache.derby.client.am.SqlException: executeQuery method can not be used for update.
> 	at org.apache.derby.client.am.Statement.checkForAppropriateSqlMode(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeQueryX(Unknown Source)
> The problem appears to be in Statment.parseSqlAndSetSqlModes(), which only appears to check for "--" style comments.

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