I think this is working as advertised now, and was working purely by accident before. E.g.:

http://cayenne.apache.org/doc/path-expressions.html

"As described in the following chapters a path expression is usually matched against some value (see for example ExpressionFactory API - the first argument to each method is a path, and a second - an object value that is matched against the path). A type of such value must be compatible with the type of the property pointed to by the path. E.g. toArtist.artistName can only be matched against a String, and toArtist - against instances of Artist."

Andrus

On Jan 11, 2010, at 8:38 PM, Andrey Razumovsky (JIRA) wrote:


[ https://issues.apache.org/jira/browse/CAY-1298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrey Razumovsky updated CAY-1298:
-----------------------------------

  Fix Version/s: 3.0RC2

This is a regression and should be addressed before final release

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: 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
          Fix For: 3.0RC2

      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.



Reply via email to