Andrus Adamchik closed CAY-1121.
--------------------------------
Resolution: Fixed
> EJBQL collection binding
> ------------------------
>
> Key: CAY-1121
> URL: https://issues.apache.org/cayenne/browse/CAY-1121
> Project: Cayenne
> Issue Type: Bug
> Components: Cayenne Core Library
> Affects Versions: 3.0
> Reporter: Andrus Adamchik
> Assignee: Andrus Adamchik
> Fix For: 3.0
>
>
> When binding collections as EJBQL variable, Cayenne erroneously binds each collection value as VARBINARY at the JDBC level. This works ok on some DB's (hiding the problem) but breaks on some others. E.g. on SQLServer:
> List<Integer> id = ...
>
> String ejbql = "delete from MeaningfulPKTest1 m WHERE m.pkAttribute in (:id)";
>
> EJBQLQuery query = new EJBQLQuery(ejbql);
> query.setParameter("id", id);
> Results in the following error:
> INFO: *** error.
> com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from INTEGER to VARBINARY is unsupported.
> at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:130)
> at com.microsoft.sqlserver.jdbc.DataTypes.throwConversionError(DataTypes.java:879)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:913)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:884)
> at org.apache.cayenne.access.types.AbstractType.setJdbcObject(AbstractType.java:79)
> at org.apache.cayenne.dba.JdbcAdapter.bindParameter(JdbcAdapter.java:497)
> at org.apache.cayenne.dba.sybase.SybaseAdapter.bindParameter(SybaseAdapter.java:99)
> at org.apache.cayenne.access.jdbc.SQLTemplateAction.bind(SQLTemplateAction.java:325)
> at org.apache.cayenne.access.jdbc.SQLTemplateAction.execute(SQLTemplateAction.java:150)
> at org.apache.cayenne.access.jdbc.SQLTemplateAction.performAction(SQLTemplateAction.java:127)
> at org.apache.cayenne.access.jdbc.EJBQLAction.performAction(EJBQLAction.java:101)
> at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:58)
> at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:237)
> at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:424)
> at org.apache.cayenne.access.DataDomainQueryAction.access$0(DataDomainQueryAction.java:403)
> at org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:397)
> at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:847)
> at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:394)
> at org.apache.cayenne.access.UnitTestDomainQueryAction.runQueryInTransaction(UnitTestDomainQueryAction.java:55)
> at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:120)
> at org.apache.cayenne.access.UnitTestDomainQueryAction.execute(UnitTestDomainQueryAction.java:49)
> at org.apache.cayenne.access.UnitTestDomain.onQuery(UnitTestDomain.java:63)
> at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:317)
> at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
> at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1326)
> at org.apache.cayenne.access.DataContext.performGenericQuery(DataContext.java:1285)
> at org.apache.cayenne.access.DataContextEJBQLDeleteTest.testDeleteIdVar(DataContextEJBQLDeleteTest.java:98)
> The problem is SQLTemplate #bind directive incomplete collection handling.
-- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
This archive was generated by hypermail 2.0.0 : Sat Oct 11 2008 - 16:09:36 EDT