db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Art Allisany (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4338) Network client raises error "executeQuery method can not be used for update" when sql is preceded by /* */ comments
Date Fri, 14 Aug 2009 13:39:14 GMT

    [ 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 -

> 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:
>            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.

View raw message