You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Dave Dombrosky (JIRA)" <ji...@apache.org> on 2009/10/30 11:38:59 UTC
[jira] Updated: (CAY-1298) String no longer works in query when
column type is Integer
[ https://issues.apache.org/jira/browse/CAY-1298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dave Dombrosky updated CAY-1298:
--------------------------------
Attachment: CharType.diff
This patch will revert the code to a working state. It is not the correct fix though, because the old types code is deprecated.
> String no longer works in query when column type is Integer
> -----------------------------------------------------------
>
> Key: CAY-1298
> URL: https://issues.apache.org/jira/browse/CAY-1298
> Project: Cayenne
> Issue Type: Bug
> Components: Cayenne Core Library
> Affects Versions: 3.0 beta 1
> Environment: IcedTea6 1.6.1
> PostgreSQL 8.3
> JDBC 8.3-603.jdbc4
> Reporter: Dave Dombrosky
> Priority: Minor
> Attachments: CharType.diff
>
>
> I have queries that no longer work in 3.0B1, because of a change that was made in revision 813661. For example, a query like this used to work:
> DataObjectUtils.objectForPK(db, Artist.class, "1");
> But now, I get the following error:
> org.postgresql.util.PSQLException: ERROR: operator does not exist: smallint = character varying
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
> at org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
> at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
> at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:274)
> at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:418)
> at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:65)
> at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:391)
> at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
> at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:388)
> at org.apache.cayenne.access.DataDomainQueryAction.interceptOIDQuery(DataDomainQueryAction.java:155)
> at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:112)
> at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:743)
> at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
> at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
> at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
> at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
> at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:273)
> at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:259)
> at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:170)
> at Test.main(Test.java:9)
> Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT Oct 30 2009 10:19:35] Query exception.
> at org.apache.cayenne.access.DataDomainQueryAction.nextQueryException(DataDomainQueryAction.java:545)
> at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:281)
> at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:418)
> at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:65)
> at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:391)
> at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
> at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:388)
> at org.apache.cayenne.access.DataDomainQueryAction.interceptOIDQuery(DataDomainQueryAction.java:155)
> at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:112)
> at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:743)
> at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
> at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
> at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
> at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
> at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:273)
> at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:259)
> at org.apache.cayenne.DataObjectUtils.objectForPK(DataObjectUtils.java:170)
> at Test.main(Test.java:9)
> Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: smallint = character varying
> at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
> at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
> at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
> at org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
> at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
> at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:274)
> ... 16 more
> The strange part is that the logger shows the query as SELECT t0.name, t0.id FROM lookup.color t0 WHERE t0.id = ? [bind: 1->id:'1'], both before and after the change. Postgres can usually deal with using a character type to match on an integer column. Something must have changed with the JDBC binding that is not showing up in the textual representation of the query.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.