cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Muthumari, Sundaresan" <smuthum...@atsc.com>
Subject Getting an error while doing an DB update using EJB QL
Date Wed, 11 May 2011 17:14:24 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message