cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Getting an error while doing an DB update using EJB QL
Date Fri, 13 May 2011 10:50:38 GMT
Hi,

this looks like a bug. Could you please open a bug report with the information below and a
version of Cayenne you are using. We'll investigate.

Thanks,
Andrus

On May 11, 2011, at 8:14 PM, Muthumari, Sundaresan wrote:

> Hello Cayenne support
>                Here is my code where I am trying to update a table by
> using EJB Query language. The parameter I pass for the subquery  is an
> object.
> 
> 
> 
> 
> 
> EJBQLQuery updateQueryDoc = new EJBQLQuery( 
> 
> 
> "UPDATE Document AS doc SET doc.lastUpdatedDate = :todaySQLdt WHERE
> (doc.toPublication = :objectParam ) "); 
> 
> 
> 
> 
> 
> 
> 
> 
> Publication pubication = (Publication) type;
> 
> 
> 
> 
> Date today = new Date();
> 
> 
> SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
> 
> 
> String todayStr = fmt.format(today);
> 
> 
> 
> 
> java.sql.Date todaySQLdt = java.sql.Date.valueOf(new String(todayStr));
> 
> 
> 
> 
> 
> updateQuery.setParameter( "todaySQLdt", todaySQLdt );
> 
> 
> 
> 
> updateQuery.setParameter( "objectParam", pubication );
> 
> 
> dataContext.performNonSelectingQuery(updateQueryDoc);
> 
> 
> 
> 
> 
> 
> Upon execution I am getting the following run time error. Could you
> please help me fix this issue
> 
> 
> 
> java.lang.ClassCastException:
> org.apache.cayenne.ejbql.parser.EJBQLUpdateValue cannot be cast to
> org.apache.cayenne.ejbql.parser.EJBQLEquals
> 
>                at
> org.apache.cayenne.ejbql.parser.EJBQLNamedInputParameter.getParent(EJBQL
> NamedInputParameter.java:38)
> 
>                at
> org.apache.cayenne.access.jdbc.EJBQLConditionTranslator.processParameter
> (EJBQLConditionTranslator.java:821)
> 
>                at
> org.apache.cayenne.access.jdbc.EJBQLConditionTranslator.visitNamedInputP
> arameter(EJBQLConditionTranslator.java:450)
> 
>                at
> org.apache.cayenne.ejbql.parser.EJBQLNamedInputParameter.visitNode(EJBQL
> NamedInputParameter.java:34)
> 
>                at
> org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:59)
> 
>                at
> org.apache.cayenne.ejbql.parser.SimpleNode.visitChild(SimpleNode.java:83
> )
> 
>                at
> org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:63)
> 
>                at
> org.apache.cayenne.ejbql.parser.SimpleNode.visitChild(SimpleNode.java:83
> )
> 
>                at
> org.apache.cayenne.ejbql.parser.EJBQLUpdateItem.visitChild(EJBQLUpdateIt
> em.java:39)
> 
>                at
> org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:63)
> 
>                at
> org.apache.cayenne.access.jdbc.EJBQLUpdateTranslator.visitUpdateItem(EJB
> QLUpdateTranslator.java:71)
> 
>                at
> org.apache.cayenne.ejbql.parser.EJBQLUpdateItem.visitNode(EJBQLUpdateIte
> m.java:34)
> 
>                at
> org.apache.cayenne.ejbql.parser.SimpleNode.visit(SimpleNode.java:59)
> 
> 
> 
> Thanks
> 
> Sunny Muthumari
> 


Mime
View raw message